secubox-openwrt/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/logs.js
CyberMind-FR e58f479cd4 feat(waf): Update WAF scenarios with 2024-2025 CVEs and OWASP threats
Add detection patterns for latest actively exploited vulnerabilities:
- CVE-2025-55182 (React2Shell, CVSS 10.0)
- CVE-2025-8110 (Gogs RCE), CVE-2025-53770 (SharePoint)
- CVE-2025-52691 (SmarterMail), CVE-2025-40551 (SolarWinds)
- CVE-2024-47575 (FortiManager), CVE-2024-21887 (Ivanti)
- CVE-2024-3400, CVE-2024-0012, CVE-2024-9474 (PAN-OS)

New attack categories based on OWASP Top 10 2025:
- HTTP Request Smuggling (TE.CL/CL.TE conflicts)
- AI/LLM Prompt Injection (ChatML, instruction markers)
- WAF Bypass techniques (Unicode normalization, double encoding)
- Supply Chain attacks (CI/CD poisoning, dependency confusion)
- Extended SSTI (Jinja2, Freemarker, Velocity, Thymeleaf)
- API Abuse (BOLA/IDOR, mass assignment)

CrowdSec scenarios split into 11 separate files for reliability.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 05:02:57 +01:00

147 lines
4.8 KiB
JavaScript

'use strict';
'require view';
'require secubox-admin/api as API';
'require poll';
'require secubox-theme/theme as Theme';
'require secubox-portal/header as SbHeader';
'require secubox/kiss-theme as KissTheme';
var lang = (typeof L !== 'undefined' && L.env && L.env.lang) ||
(document.documentElement && document.documentElement.getAttribute('lang')) ||
(navigator.language ? navigator.language.split('-')[0] : 'en');
Theme.init({ language: lang });
var ADMIN_NAV = [
{ id: 'dashboard', icon: '🎛️', label: 'Control Panel' },
{ id: 'cyber-dashboard', icon: '🔮', label: 'Cyber Console' },
{ id: 'apps', icon: '📦', label: 'Apps Manager' },
{ id: 'updates', icon: '🔄', label: 'Updates' },
{ id: 'catalog-sources', icon: '📚', label: 'Catalog' },
{ id: 'health', icon: '💚', label: 'Health' },
{ id: 'logs', icon: '📋', label: 'Logs' },
{ id: 'settings', icon: '⚙️', label: 'Settings' }
];
function renderAdminNav(activeId) {
return E('div', {
'class': 'sb-app-nav',
'style': 'display:flex;gap:8px;margin-bottom:20px;padding:12px 16px;background:#141419;border:1px solid rgba(255,255,255,0.08);border-radius:12px;flex-wrap:wrap;'
}, ADMIN_NAV.map(function(item) {
var isActive = activeId === item.id;
return E('a', {
'href': L.url('admin', 'secubox', 'admin', item.id),
'style': 'display:flex;align-items:center;gap:8px;padding:10px 16px;border-radius:8px;text-decoration:none;font-size:14px;font-weight:500;transition:all 0.2s;' +
(isActive ? 'background:linear-gradient(135deg,#667eea,#764ba2);color:white;' : 'color:#a0a0b0;background:transparent;')
}, [
E('span', {}, item.icon),
E('span', {}, _(item.label))
]);
}));
}
return view.extend({
selectedService: 'system',
load: function() {
return L.resolveDefault(API.getLogs(this.selectedService, 100), { logs: '' });
},
render: function(logsData) {
var self = this;
var logs = logsData.logs || '';
var container = E('div', { 'class': 'cyberpunk-mode secubox-logs' }, [
E('link', { 'rel': 'stylesheet', 'type': 'text/css',
'href': L.resource('secubox-admin/cyberpunk.css') + '?v=' + Date.now() }),
E('link', { 'rel': 'stylesheet',
'href': L.resource('secubox-admin/common.css') }),
E('link', { 'rel': 'stylesheet',
'href': L.resource('secubox-admin/admin.css') }),
E('div', { 'class': 'cyber-header' }, [
E('div', { 'class': 'cyber-header-title' }, '📋 SYSTEM LOGS'),
E('div', { 'class': 'cyber-header-subtitle' }, 'View logs from system services and applications')
]),
E('div', { 'class': 'logs-controls' }, [
E('select', {
'class': 'service-selector',
'change': function(ev) {
self.changeService(ev.target.value);
}
}, [
E('option', { 'value': 'system' }, 'System'),
E('option', { 'value': 'kernel' }, 'Kernel'),
E('option', { 'value': 'dockerd' }, 'Docker'),
E('option', { 'value': 'dnsmasq' }, 'DNS'),
E('option', { 'value': 'firewall' }, 'Firewall')
]),
E('button', {
'class': 'btn btn-primary',
'click': function() { self.refreshLogs(); }
}, 'Refresh'),
E('button', {
'class': 'btn',
'click': function() { self.downloadLogs(); }
}, 'Download')
]),
E('div', { 'class': 'logs-viewer card' }, [
E('pre', { 'id': 'log-content', 'class': 'log-content' }, logs || 'No logs available')
])
]);
// Auto-refresh every 10 seconds
poll.add(L.bind(this.pollLogs, this), 10);
var wrapper = E('div', { 'class': 'secubox-page-wrapper' });
wrapper.appendChild(SbHeader.render());
wrapper.appendChild(renderAdminNav('logs'));
wrapper.appendChild(container);
return KissTheme.wrap([wrapper], 'admin/secubox/admin/logs');
},
changeService: function(service) {
this.selectedService = service;
this.refreshLogs();
},
refreshLogs: function() {
var self = this;
API.getLogs(this.selectedService, 100).then(function(logsData) {
var logContent = document.getElementById('log-content');
if (logContent) {
logContent.textContent = logsData.logs || 'No logs available';
// Scroll to bottom
logContent.scrollTop = logContent.scrollHeight;
}
});
},
pollLogs: function() {
return API.getLogs(this.selectedService, 100).then(L.bind(function(logsData) {
var logContent = document.getElementById('log-content');
if (logContent) {
logContent.textContent = logsData.logs || 'No logs available';
}
}, this));
},
downloadLogs: function() {
var logContent = document.getElementById('log-content');
if (logContent) {
var blob = new Blob([logContent.textContent], { type: 'text/plain' });
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = this.selectedService + '-logs.txt';
a.click();
URL.revokeObjectURL(url);
}
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});