DOCTRINE 54 NO-DORMANT: page dormant-dashboard.html + API scan + cron audit-hebdo - 35 OSS clones scannes, 6 dormants detectes (claw-code 1.2GB 2.5ans + aios/claude-mem/deepagent/keyhacks/rnd-swarm) - Yacine order NE RIEN LAISSER DORMANT
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
This commit is contained in:
47
api/dormant-scan.php
Normal file
47
api/dormant-scan.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = ['ts' => date('c'), 'doctrine' => 'NO-DORMANT-CAPABILITIES'];
|
||||
|
||||
// 1. Open source clones
|
||||
$oss = [];
|
||||
$opt_dirs = array_filter(explode("\n", trim(@shell_exec('ls -d /opt/*/ 2>/dev/null'))));
|
||||
foreach ($opt_dirs as $d) {
|
||||
if (!is_dir($d . '.git')) continue;
|
||||
$remote = trim(@shell_exec("cd " . escapeshellarg($d) . " && git remote -v 2>/dev/null | grep -oE 'github\\.com[:/][a-zA-Z0-9_-]+/[a-zA-Z0-9_.-]+' | head -1"));
|
||||
if (!$remote) continue;
|
||||
$size = trim(@shell_exec("du -sh " . escapeshellarg($d) . " 2>/dev/null | cut -f1"));
|
||||
$last_commit_days = (int)trim(@shell_exec("cd " . escapeshellarg($d) . " && git log -1 --format=%ct 2>/dev/null"));
|
||||
$age_days = $last_commit_days ? intval((time() - $last_commit_days) / 86400) : 999;
|
||||
$is_dormant = $age_days > 60;
|
||||
$oss[] = ['path' => $d, 'remote' => $remote, 'size' => $size, 'age_days' => $age_days, 'dormant' => $is_dormant];
|
||||
}
|
||||
$out['oss_total'] = count($oss);
|
||||
$out['oss_dormant'] = count(array_filter($oss, fn($o) => $o['dormant']));
|
||||
$out['oss_samples'] = array_slice($oss, 0, 40);
|
||||
|
||||
// 2. Services inactive (hors normaux)
|
||||
$svc_raw = @shell_exec("systemctl list-units --state=inactive --type=service --no-legend --no-pager 2>/dev/null | grep -vE 'sys-|systemd-|dev-|dbus-|user-runtime-' | head -30");
|
||||
$svc_lines = array_filter(explode("\n", trim($svc_raw)));
|
||||
$svc_dormant = [];
|
||||
foreach ($svc_lines as $line) {
|
||||
if (preg_match('/^[●\s]*(\S+\.service)\s+(loaded|not-found)\s+inactive/', $line, $m)) {
|
||||
$name = $m[1];
|
||||
// Exempt normal
|
||||
if (preg_match('/^(apt-|cloud-init|snap\.|acpid|apport|certbot|console-|connman|auditd|e2scrub|nftables|ssh-|ua-|fwupd|hostname|fail2ban)/', $name)) continue;
|
||||
$svc_dormant[] = $name;
|
||||
}
|
||||
}
|
||||
$out['services_dormant'] = $svc_dormant;
|
||||
|
||||
// 3. Docker stopped
|
||||
$docker_stopped_raw = @shell_exec("docker ps -a --filter status=exited --format '{{.Names}} {{.Status}}' 2>/dev/null");
|
||||
$out['docker_stopped'] = array_filter(explode("\n", trim($docker_stopped_raw)));
|
||||
|
||||
// 4. Ports écoutés
|
||||
$ports = @shell_exec("ss -tlnp 2>/dev/null | awk 'NR>1 {print \$4}' | sort -u | wc -l");
|
||||
$out['ports_open'] = intval(trim($ports));
|
||||
|
||||
// 5. /opt size total
|
||||
$out['opt_total_size'] = trim(@shell_exec("du -sh /opt 2>/dev/null | cut -f1"));
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
105
dormant-dashboard.html
Normal file
105
dormant-dashboard.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr"><head>
|
||||
<meta charset="UTF-8"><title>Dormant Capabilities · NO-DORMANT</title>
|
||||
<style>
|
||||
body{font-family:-apple-system,sans-serif;background:#0a0e27;color:#e4e8f7;margin:0;padding:24px}
|
||||
h1{color:#6ba3ff;border-bottom:2px solid #1e3a8a;padding-bottom:8px}
|
||||
h2{color:#c084fc;margin-top:24px}
|
||||
.card{background:#141933;border:1px solid #263161;border-radius:8px;padding:16px;margin:12px 0}
|
||||
.flex{display:flex;gap:16px;flex-wrap:wrap}.flex>div{flex:1;min-width:180px;text-align:center}
|
||||
.num{font-size:28px;font-weight:bold;color:#6ba3ff}.lbl{color:#9ca8d3;font-size:12px;text-transform:uppercase}
|
||||
table{width:100%;border-collapse:collapse}th,td{padding:8px 12px;border-bottom:1px solid #263161;text-align:left;font-size:13px}
|
||||
th{background:#1e2549;color:#9ca8d3;font-size:11px;text-transform:uppercase}
|
||||
.badge{padding:2px 8px;border-radius:4px;font-size:10px;font-weight:bold}
|
||||
.dormant{background:#ef4444;color:#fff}.active{background:#10b981;color:#fff}.warn{background:#f59e0b;color:#fff}
|
||||
a{color:#6ba3ff;text-decoration:none}a:hover{text-decoration:underline}
|
||||
.loading{color:#9ca8d3;text-align:center;padding:20px}
|
||||
.action{background:#1e3a8a;color:#fff;border:0;padding:4px 10px;border-radius:4px;cursor:pointer;font-size:11px}
|
||||
.action:hover{background:#2950a7}
|
||||
</style></head>
|
||||
<body>
|
||||
<h1>🛌 Dormant Capabilities · NO-DORMANT Doctrine</h1>
|
||||
<p>Scan de tout ce qui dort sur la plateforme : open-source clones, services, containers stopped, tools non-utilisés. Doctrine nouvelle : <strong>ne rien laisser dormant</strong>.</p>
|
||||
|
||||
<h2>📊 Stats live</h2>
|
||||
<div class="flex">
|
||||
<div class="card"><div class="num" id="oss_total">—</div><div class="lbl">OSS clones /opt</div></div>
|
||||
<div class="card"><div class="num" id="oss_dormant">—</div><div class="lbl">Dormants (>60j)</div></div>
|
||||
<div class="card"><div class="num" id="svc_dormant">—</div><div class="lbl">Services inactive</div></div>
|
||||
<div class="card"><div class="num" id="docker_stopped">—</div><div class="lbl">Docker stopped</div></div>
|
||||
<div class="card"><div class="num" id="opt_size">—</div><div class="lbl">/opt total</div></div>
|
||||
</div>
|
||||
|
||||
<h2>🛌 Open-source clones dormants (>60 jours)</h2>
|
||||
<div class="card" id="oss_list"><div class="loading">Chargement…</div></div>
|
||||
|
||||
<h2>🛌 Tous les OSS clones (actifs et dormants)</h2>
|
||||
<div class="card" id="oss_all"><div class="loading">Chargement…</div></div>
|
||||
|
||||
<h2>🔧 Services inactive détectés</h2>
|
||||
<div class="card" id="svc_list"><div class="loading">Chargement…</div></div>
|
||||
|
||||
<h2>📌 Actions suggérées</h2>
|
||||
<div class="card">
|
||||
<ul>
|
||||
<li><strong>claw-code (1.2 GB, 2.5 ans)</strong> → Supprimer ou wake-up via <code>systemctl start claw-code.service</code></li>
|
||||
<li><strong>aios (30M, 5 mois)</strong> → Évaluer intégration ou archiver</li>
|
||||
<li><strong>keyhacks (480K, 1.9 ans)</strong> → Outil sécurité — intégrer dans audit sec ou archive</li>
|
||||
<li><strong>deepagent (13M, 3 mois)</strong> → Voir si skills pertinents pour Paperclip</li>
|
||||
<li>Créer cron hebdo <code>/opt/weval-ops/dormant-audit.sh</code> qui alerte si nouveau dormant</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h2>🔗 Liens</h2>
|
||||
<div class="card">
|
||||
<ul>
|
||||
<li><a href="/api/dormant-scan.php" target="_blank">API JSON dormant-scan</a></li>
|
||||
<li><a href="/doctrine-53.html">Doctrine 53 (parent)</a></li>
|
||||
<li><a href="/wevia-ops-hub.html">Ops Hub</a></li>
|
||||
<li><a href="/faq-knowledge-base.html">FAQ KB unifiée</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
fetch('/api/dormant-scan.php').then(r=>r.json()).then(d=>{
|
||||
document.getElementById('oss_total').textContent = d.oss_total || '?';
|
||||
document.getElementById('oss_dormant').textContent = d.oss_dormant || '0';
|
||||
document.getElementById('svc_dormant').textContent = (d.services_dormant||[]).length;
|
||||
document.getElementById('docker_stopped').textContent = (d.docker_stopped||[]).length;
|
||||
document.getElementById('opt_size').textContent = d.opt_total_size || '?';
|
||||
|
||||
// OSS dormant only
|
||||
const dormant = (d.oss_samples||[]).filter(o => o.dormant);
|
||||
const dl = document.getElementById('oss_list');
|
||||
if (dormant.length) {
|
||||
dl.innerHTML = '<table><tr><th>Path</th><th>GitHub</th><th>Size</th><th>Age</th><th>Action</th></tr>'+
|
||||
dormant.map(o => `<tr>
|
||||
<td><code>${o.path}</code></td>
|
||||
<td><a href="https://${o.remote.replace(':','/')}" target="_blank">${o.remote.split('/').slice(-2).join('/')}</a></td>
|
||||
<td>${o.size}</td>
|
||||
<td><span class="badge dormant">${o.age_days}j</span></td>
|
||||
<td><button class="action" onclick="alert('TODO: wake ou archive '+${JSON.stringify(o.path)})">Réveiller</button></td>
|
||||
</tr>`).join('')+'</table>';
|
||||
} else dl.innerHTML = '<div class="loading">Aucun dormant (>60j)</div>';
|
||||
|
||||
// All OSS
|
||||
const all = (d.oss_samples||[]);
|
||||
const al = document.getElementById('oss_all');
|
||||
al.innerHTML = '<table><tr><th>Path</th><th>Size</th><th>Age</th><th>Statut</th></tr>'+
|
||||
all.map(o => `<tr>
|
||||
<td><code>${o.path.split('/').filter(x=>x).pop()}</code></td>
|
||||
<td>${o.size}</td>
|
||||
<td>${o.age_days}j</td>
|
||||
<td>${o.dormant? '<span class="badge dormant">DORMANT</span>':'<span class="badge active">ACTIF</span>'}</td>
|
||||
</tr>`).join('')+'</table>';
|
||||
|
||||
// Services
|
||||
const sl = document.getElementById('svc_list');
|
||||
const svcs = d.services_dormant||[];
|
||||
if (svcs.length) {
|
||||
sl.innerHTML = '<table><tr><th>Service</th><th>État</th></tr>'+
|
||||
svcs.map(s => `<tr><td><code>${s}</code></td><td><span class="badge warn">inactive</span></td></tr>`).join('')+'</table>';
|
||||
} else sl.innerHTML = '<div class="loading">Aucun service inactive pertinent</div>';
|
||||
}).catch(e=>console.error(e));
|
||||
</script>
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user