No One Can Stop Me Now

This commit is contained in:
DigiJ
2026-03-13 23:48:47 -07:00
parent 4d3570781e
commit 1a138a2bd0
428 changed files with 519668 additions and 259 deletions

View File

@@ -1,29 +1,29 @@
{% extends "base.html" %}
{% block title %}Linux Defense - AUTARCH{% endblock %}
{% block title %}Linux Defense AUTARCH{% endblock %}
{% block content %}
<div class="page-header" style="display:flex;align-items:center;gap:1rem;flex-wrap:wrap">
<div>
<h1>Linux Defense</h1>
<p style="margin:0;font-size:0.85rem;color:var(--text-secondary)">
Linux system hardening, iptables firewall management, and log analysis.
System hardening, iptables firewall management, and log analysis
</p>
</div>
<a href="{{ url_for('defense.index') }}" class="btn btn-sm" style="margin-left:auto">&larr; Defense</a>
</div>
<!-- Security Audit -->
<div class="section">
<h2>Security Audit</h2>
<div class="tool-actions">
<button id="btn-audit" class="btn btn-primary" onclick="linuxRunAudit()">Run Full Audit</button>
<div class="card">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;flex-wrap:wrap;gap:0.5rem">
<h3 style="margin:0">Security Audit</h3>
<button id="btn-audit" class="btn btn-primary btn-sm" onclick="linuxRunAudit()">Run Full Audit</button>
</div>
<div style="display:flex;gap:24px;align-items:flex-start;flex-wrap:wrap">
<div class="score-display">
<div class="score-value" id="audit-score">--</div>
<div class="score-label">Security Score</div>
<div style="text-align:center;padding:12px 20px;background:var(--bg-primary);border:1px solid var(--border);border-radius:var(--radius);min-width:120px">
<div id="audit-score" style="font-size:2.5rem;font-weight:700;line-height:1">--</div>
<div style="font-size:0.78rem;color:var(--text-secondary);margin-top:4px">Security Score</div>
</div>
<div style="flex:1;min-width:300px">
<div style="flex:1;min-width:280px">
<table class="data-table">
<thead><tr><th>Check</th><th>Status</th><th>Details</th></tr></thead>
<tbody id="audit-results">
@@ -34,94 +34,53 @@
</div>
</div>
<!-- Individual Checks -->
<div class="section">
<h2>Quick Checks</h2>
<div class="tool-grid">
<div class="tool-card">
<h4>Firewall</h4>
<p>Check iptables/ufw/firewalld status</p>
<button class="btn btn-small" onclick="linuxRunCheck('firewall')">Run</button>
<pre class="output-panel tool-result" id="check-result-firewall"></pre>
</div>
<div class="tool-card">
<h4>SSH Config</h4>
<p>Check SSH hardening settings</p>
<button class="btn btn-small" onclick="linuxRunCheck('ssh')">Run</button>
<pre class="output-panel tool-result" id="check-result-ssh"></pre>
</div>
<div class="tool-card">
<h4>Open Ports</h4>
<p>Scan for high-risk listening ports</p>
<button class="btn btn-small" onclick="linuxRunCheck('ports')">Run</button>
<pre class="output-panel tool-result" id="check-result-ports"></pre>
</div>
<div class="tool-card">
<h4>Users</h4>
<p>Check UID 0 users and empty passwords</p>
<button class="btn btn-small" onclick="linuxRunCheck('users')">Run</button>
<pre class="output-panel tool-result" id="check-result-users"></pre>
</div>
<div class="tool-card">
<h4>Permissions</h4>
<p>Check critical file permissions</p>
<button class="btn btn-small" onclick="linuxRunCheck('permissions')">Run</button>
<pre class="output-panel tool-result" id="check-result-permissions"></pre>
</div>
<div class="tool-card">
<h4>Services</h4>
<p>Check for dangerous services</p>
<button class="btn btn-small" onclick="linuxRunCheck('services')">Run</button>
<pre class="output-panel tool-result" id="check-result-services"></pre>
<!-- Quick Checks -->
<div class="card">
<h3>Quick Checks</h3>
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px">
{% for check_id, check_name, check_desc in [
('firewall', 'Firewall', 'Check iptables/ufw/firewalld status'),
('ssh', 'SSH Config', 'Check SSH hardening settings'),
('ports', 'Open Ports', 'Scan for high-risk listening ports'),
('users', 'Users', 'Check UID 0 users and empty passwords'),
('permissions', 'Permissions', 'Check critical file permissions'),
('services', 'Services', 'Check for dangerous services')
] %}
<div style="background:var(--bg-primary);border:1px solid var(--border);border-radius:var(--radius);padding:14px">
<div style="font-weight:600;font-size:0.88rem;margin-bottom:4px">{{ check_name }}</div>
<div style="color:var(--text-secondary);font-size:0.78rem;margin-bottom:10px">{{ check_desc }}</div>
<button class="btn btn-sm" style="width:100%" onclick="linuxRunCheck('{{ check_id }}')">Run</button>
<pre class="output-panel tool-result" id="check-result-{{ check_id }}" style="display:none;margin-top:10px;font-size:0.75rem;min-height:0"></pre>
</div>
{% endfor %}
</div>
</div>
<!-- Firewall Manager -->
<div class="section">
<h2>Firewall Manager (iptables)</h2>
<div class="tool-actions">
<button class="btn btn-small" onclick="linuxLoadFwRules()">Refresh Rules</button>
<div class="card">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;flex-wrap:wrap;gap:0.5rem">
<h3 style="margin:0">Firewall Manager (iptables)</h3>
<button class="btn btn-sm" onclick="linuxLoadFwRules()">Refresh Rules</button>
</div>
<pre class="output-panel scrollable" id="fw-rules">Click "Refresh Rules" to load current iptables rules.</pre>
<div style="margin-top:12px">
<div class="input-row">
<input type="text" id="block-ip" placeholder="IP address to block">
<button class="btn btn-danger btn-small" onclick="linuxBlockIP()">Block IP</button>
<button class="btn btn-small" onclick="linuxUnblockIP()">Unblock IP</button>
</div>
<pre class="output-panel" id="fw-result" style="min-height:0"></pre>
<pre class="output-panel" id="fw-rules" style="max-height:300px;overflow-y:auto">Click "Refresh Rules" to load current iptables rules.</pre>
<div style="display:flex;gap:8px;margin-top:12px;flex-wrap:wrap">
<input type="text" id="block-ip" class="form-control" placeholder="IP address to block" style="flex:1;min-width:180px">
<button class="btn btn-sm btn-danger" onclick="linuxBlockIP()">Block IP</button>
<button class="btn btn-sm" onclick="linuxUnblockIP()">Unblock IP</button>
</div>
<pre class="output-panel" id="fw-result" style="min-height:0;margin-top:8px"></pre>
</div>
<!-- Log Analysis -->
<div class="section">
<h2>Log Analysis</h2>
<div class="tool-actions">
<button id="btn-logs" class="btn btn-primary" onclick="linuxAnalyzeLogs()">Analyze Logs</button>
<div class="card">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;flex-wrap:wrap;gap:0.5rem">
<h3 style="margin:0">Log Analysis</h3>
<button id="btn-logs" class="btn btn-primary btn-sm" onclick="linuxAnalyzeLogs()">Analyze Logs</button>
</div>
<pre class="output-panel scrollable" id="log-output">Click "Analyze Logs" to parse auth and web server logs.</pre>
<pre class="output-panel" id="log-output" style="max-height:350px;overflow-y:auto">Click "Analyze Logs" to parse auth and web server logs.</pre>
</div>
{% if modules %}
<div class="section">
<h2>Defense Modules</h2>
<ul class="module-list">
{% for name, info in modules.items() %}
<li class="module-item">
<div>
<div class="module-name">{{ name }}</div>
<div class="module-desc">{{ info.description }}</div>
</div>
<div class="module-meta">v{{ info.version }}</div>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<script>
/* ── Linux Defense (routes prefixed with /defense/linux/) ── */
function linuxRunAudit() {
var btn = document.getElementById('btn-audit');
setLoading(btn, true);