/* ESPILON Honeypot Dashboard — Credentials Tab */ import { S } from './state.js'; import { $id, escHtml, maskPassword, svcIcon, emptyState, skeletonRows } from './utils.js'; import { api } from './api.js'; export async function renderCredentials() { const ml = $id('main-list'); if (!ml) return; ml.innerHTML = skeletonRows(5); if (!S.credentials) { S.credentials = await api('/api/honeypot/credentials'); } const c = S.credentials; if (!c) { ml.innerHTML = emptyState('\uD83D\uDD12', 'No credential data', 'Captured credentials will be shown here'); return; } let html = '
'; // Top Usernames html += '
Top Usernames
'; html += ''; const users = c.top_usernames || []; for (let i = 0; i < users.length; i++) { const u = users[i]; html += '' + '' + '' + ''; } html += '
#UsernameCountServices
' + (i + 1) + '' + escHtml(u.username) + '' + u.cnt + '' + escHtml(Array.isArray(u.services) ? u.services.join(', ') : (u.services || '')) + '
'; // Top Passwords html += '
Top Passwords
'; html += ''; const passwords = c.top_passwords || []; for (let i = 0; i < passwords.length; i++) { const p = passwords[i]; const masked = maskPassword(p.password); html += '' + '' + '' + ''; } html += '
#PasswordCountServices
' + (i + 1) + '' + escHtml(masked) + '' + p.cnt + '' + escHtml(Array.isArray(p.services) ? p.services.join(', ') : (p.services || '')) + '
'; // Top Combos html += '
Top Combos
'; html += ''; const combos = c.top_combos || []; for (let i = 0; i < combos.length; i++) { const cb = combos[i]; html += '' + '' + '' + ''; } html += '
#Username:PasswordCountService
' + (i + 1) + '' + escHtml(cb.username) + ':' + escHtml(maskPassword(cb.password)) + '' + cb.cnt + '' + escHtml(cb.service || '') + '
'; // By Service html += '
By Service
'; html += ''; const bySvc = c.by_service || []; for (let i = 0; i < bySvc.length; i++) { const sv = bySvc[i]; html += '' + '' + ''; } html += '
ServiceUnique UsersTotal Attempts
' + svcIcon(sv.service) + ' ' + escHtml(sv.service) + '' + sv.unique_users + '' + sv.total_attempts + '
'; html += '
'; ml.innerHTML = html; }