CI / Format and vet (pull_request) Successful in 1m1s
CI / Dependency audit (pull_request) Successful in 32s
CI / Tests (Linux, race detector) (pull_request) Successful in 1m55s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build hub image (amd64) (push) Skipped
Release / Build probe image (amd64) (push) Skipped
Release / Build hub image (arm64) (push) Skipped
Release / Build probe image (arm64) (push) Skipped
Release / Publish tags (hub) (push) Skipped
Release / Publish tags (probe) (push) Skipped
Release / Gitea release (push) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2083 lines
111 KiB
JavaScript
2083 lines
111 KiB
JavaScript
/* Urutau - página Análise de IP (#/ip/<ip>).
|
||
Rolagem única com índice, veredito, atividade, técnicas, sessões, alvos,
|
||
clientes e relações. Tudo que vem do log ou do peer (caminho, UA, rDNS,
|
||
cidade, usuário SSH) é hostil: entra só por textContent, classes vêm de
|
||
listas fixas e os links externos são montados aqui a partir do IP e do ASN
|
||
validados, nunca copiados do servidor. Cada seção é opcional: se o backend
|
||
ainda não envia o campo, a seção some ou mostra um estado vazio. */
|
||
(function () {
|
||
'use strict';
|
||
var U = window.Urutau;
|
||
if (!U || typeof U.registerPage !== 'function') return;
|
||
|
||
// ---------------------------------------------------------------- i18n
|
||
U.registerI18n({
|
||
en: {
|
||
'ip.title': 'IP analysis',
|
||
'ip.back': 'IPs',
|
||
'ip.back.label': 'Back to the IP list',
|
||
'ip.period': 'Period: {range}',
|
||
'ip.toc': 'Sections',
|
||
'ip.sec.verdict': 'Verdict',
|
||
'ip.sec.activity': 'Activity',
|
||
'ip.sec.defense': 'Defense',
|
||
'ip.sec.techniques': 'Techniques',
|
||
'ip.sec.sessions': 'Sessions',
|
||
'ip.sec.targets': 'Targets',
|
||
'ip.sec.clients': 'Clients',
|
||
'ip.sec.related': 'Related',
|
||
'ip.loading': 'Loading the analysis.',
|
||
'ip.invalid': 'This is not a valid IP address.',
|
||
'ip.error': 'Could not load this IP.',
|
||
'ip.notfound': 'No activity from this IP in the selected period.',
|
||
'ip.notfound.hint': 'Pick a longer period above, or the IP was never seen.',
|
||
'ip.retry': 'Try again',
|
||
'ip.lead.hostile': 'Hostile: {events} {range}',
|
||
'ip.lead.suspicious': 'Suspicious: {events} {range}',
|
||
'ip.lead.low': 'Low risk: {events} {range}',
|
||
'ip.lead.admin': 'Recognized administrator: {events} {range}',
|
||
'ip.lead.none': 'No events from this IP {range}',
|
||
'ip.lead.against.one': 'against {n} domain',
|
||
'ip.lead.against.other': 'against {n} domains',
|
||
'ip.lead.banned': 'banned by {jails}',
|
||
'ip.lead.bannedNow': 'currently banned',
|
||
'ip.n.events.one': '{n} event',
|
||
'ip.n.events.other': '{n} events',
|
||
'ip.n.sessions.one': '{n} session',
|
||
'ip.n.sessions.other': '{n} sessions',
|
||
'ip.n.days.one': '{n} day',
|
||
'ip.n.days.other': '{n} days',
|
||
'ip.score': 'Score',
|
||
'ip.score.of': 'out of 1000',
|
||
'ip.score.label': 'Score {n} of 1000',
|
||
'ip.level': 'Level',
|
||
'ip.level.hostile': 'Hostile',
|
||
'ip.level.suspicious': 'Suspicious',
|
||
'ip.level.low': 'Low',
|
||
'ip.admin': 'Administrator',
|
||
'ip.confidence': 'Confidence',
|
||
'ip.confidence.high': 'high: strong evidence',
|
||
'ip.confidence.medium': 'moderate: weak signals only',
|
||
'ip.confidence.admin': 'not applicable (administrator)',
|
||
'ip.reasons': 'Why this verdict',
|
||
'ip.reasons.empty': 'No scoring reasons were reported for this IP.',
|
||
'ip.reasons.weight': 'weight',
|
||
'ip.reason.exploits_refused.one': '{n} exploit attempt was refused (4xx/5xx) on: {families}.',
|
||
'ip.reason.exploits_refused.other': '{n} exploit attempts were refused (4xx/5xx) on: {families}.',
|
||
'ip.reason.tool_ua': 'Identifies itself with an attack tool: {tool}.',
|
||
'ip.reason.banned_jail': 'Banned by fail2ban: {jails}.',
|
||
'ip.reason.multi_category.one': 'Seen in {n} malicious category.',
|
||
'ip.reason.multi_category.other': 'Seen in {n} different malicious categories.',
|
||
'ip.reason.exposure.one': 'Got {n} successful (2xx) answer on a sensitive path: {families}.',
|
||
'ip.reason.exposure.other': 'Got {n} successful (2xx) answers on sensitive paths: {families}.',
|
||
'ip.reason.ssh_login_after_bruteforce': 'Logged in over SSH after a brute force run.',
|
||
'ip.reason.admin': 'Recognized as an administrator address (lowers the score).',
|
||
'ip.reason.immune': 'Allowlisted (immune to bans).',
|
||
'ip.reason.unknown': 'Signal: {code}',
|
||
'ip.actions': 'Recommended actions',
|
||
'ip.actions.empty': 'No action recommended.',
|
||
'ip.action.block': 'Block this IP (firewall or fail2ban).',
|
||
'ip.action.report': 'Report it to the network owner or an abuse database.',
|
||
'ip.action.keep_blocked': 'Keep it blocked: it is banned and the ban is still active.',
|
||
'ip.action.replay': 'See what it did, step by step, in the Replay.',
|
||
'ip.score.cuts': 'Cutoffs: suspicious from {a}, hostile from {b}.',
|
||
'ip.score.rule.k': 'Hostile by rule:',
|
||
'ip.cl.interp': 'Interpreted clients',
|
||
'ip.cl.status.fromEvents': 'Counted from the {n} events loaded below.',
|
||
'ip.nolog': 'No detail to list: the event log does not cover this period, but the counters show {n} events.',
|
||
'ip.est': 'Estimated from the counters: the event log does not cover this period.',
|
||
'ip.ssh.counters': '{n} failed SSH logins were counted, but the user names are not available for this period.',
|
||
'ip.def.noinfo': 'The ban history of this period is not available.',
|
||
'ip.action.investigate': 'Investigate the exposed data and the server logs around the successful requests.',
|
||
'ip.action.incident': 'Treat as an incident: rotate exposed secrets and review the affected accounts.',
|
||
'ip.expo.title': 'CRITICAL: the server answered with content on a sensitive path',
|
||
'ip.expo.body': 'These requests got a 2xx answer. The attacker may now hold the file, so rotate any secret it contains.',
|
||
'ip.expo.path': 'Path',
|
||
'ip.expo.status': 'Status',
|
||
'ip.expo.size': 'Size',
|
||
'ip.expo.host': 'Host',
|
||
'ip.expo.more': 'Show {n} more',
|
||
'ip.expo.less': 'Show fewer',
|
||
'ip.inc.title': 'INCIDENT: successful SSH login after failed attempts',
|
||
'ip.inc.body': 'This address guessed a valid credential after failing {n} times. Treat the account as compromised: end its sessions, change the credentials and check what it ran.',
|
||
'ip.inc.body.nofails': 'This address logged in over SSH after a brute force run. Treat the account as compromised: end its sessions, change the credentials and check what it ran.',
|
||
'ip.id.location': 'Location',
|
||
'ip.id.approx': 'approx.',
|
||
'ip.id.network': 'Network',
|
||
'ip.id.rdns': 'Reverse DNS',
|
||
'ip.id.rdns.none': 'no reverse DNS',
|
||
'ip.id.fcrdns.ok': 'FCrDNS verified',
|
||
'ip.id.fcrdns.bad': 'FCrDNS fails',
|
||
'ip.id.fcrdns.hint': 'Forward-confirmed reverse DNS: the name resolves back to this address.',
|
||
'ip.id.nettype': 'Network type',
|
||
'ip.id.prefix': 'Prefix',
|
||
'ip.id.unknown': 'unknown',
|
||
'ip.nt.tor': 'Tor exit',
|
||
'ip.nt.vpn': 'VPN',
|
||
'ip.nt.research-scanner': 'Research scanner',
|
||
'ip.nt.isp-cn': 'Chinese ISP',
|
||
'ip.nt.hosting': 'Hosting',
|
||
'ip.nt.mobile': 'Mobile',
|
||
'ip.nt.isp-mobile': 'ISP / mobile',
|
||
'ip.nt.residential': 'Residential',
|
||
'ip.nt.unknown': 'Unknown',
|
||
'ip.ntr.asn': 'known ASN {v}',
|
||
'ip.ntr.asorg': 'organization name contains "{v}"',
|
||
'ip.ntr.rdns': 'reverse DNS contains "{v}"',
|
||
'ip.ntr.tor': 'listed as a Tor exit node (official list)',
|
||
'ip.untrusted': 'text sent by the attacker',
|
||
'ip.act.copy': 'Copy IP',
|
||
'ip.act.ioc': 'Copy as IOC',
|
||
'ip.act.json': 'Export JSON',
|
||
'ip.act.stix': 'STIX 2.1',
|
||
'ip.act.replay': 'Replay this IP',
|
||
'ip.act.copied': 'Copied.',
|
||
'ip.act.copyfail': 'Could not copy.',
|
||
'ip.ext.title': 'Look it up elsewhere',
|
||
'ip.ext.note': 'Opens in a new tab. Nothing is sent until you click.',
|
||
'ip.ext.abuseipdb': 'AbuseIPDB',
|
||
'ip.ext.greynoise': 'GreyNoise',
|
||
'ip.ext.shodan': 'Shodan',
|
||
'ip.ext.censys': 'Censys',
|
||
'ip.ext.virustotal': 'VirusTotal',
|
||
'ip.ext.bgphe': 'bgp.he.net',
|
||
'ip.ext.ripestat': 'RIPEstat',
|
||
'ip.ext.out': '(opens another site)',
|
||
'ip.tl.title': 'Events per hour',
|
||
'ip.tl.hint': 'Stacked by category. Vertical marks are fail2ban bans.',
|
||
'ip.tl.peak': 'Peak: {n} per hour, {when}',
|
||
'ip.tl.empty': 'No hourly series for this period.',
|
||
'ip.tl.ban': 'ban',
|
||
'ip.tl.unban': 'unban',
|
||
'ip.tl.tip': '{when}: {n}',
|
||
'ip.hm.title': 'When it acts',
|
||
'ip.hm.hint': 'Events by weekday and hour (UTC) in the selected period. A fixed schedule hints at automation or a time zone.',
|
||
'ip.hm.less': 'fewer',
|
||
'ip.hm.more': 'more',
|
||
'ip.hm.tip': '{day} {hour}h UTC: {n}',
|
||
'ip.hm.empty': 'Not enough hourly data for a heatmap.',
|
||
'ip.time.title': 'Time',
|
||
'ip.time.first': 'First seen',
|
||
'ip.time.last': 'Last seen',
|
||
'ip.time.active': 'Active days',
|
||
'ip.time.sessions': 'Sessions',
|
||
'ip.time.returning': 'Returns',
|
||
'ip.time.returning.yes': 'Yes, it came back after a quiet period',
|
||
'ip.time.returning.no': 'No, a single visit',
|
||
'ip.cad.title': 'Cadence',
|
||
'ip.cad.median': 'Median gap',
|
||
'ip.cad.spread': 'p10 to p90',
|
||
'ip.cad.cv': 'CV',
|
||
'ip.cad.cv.hint': 'Coefficient of variation of the gaps. Near 0 means metronomic.',
|
||
'ip.cad.burst': 'Peak burst',
|
||
'ip.cad.burst.unit': 'in 60 s',
|
||
'ip.cad.n': 'Requests measured',
|
||
'ip.cad.automated': 'Automated',
|
||
'ip.cad.human-like': 'Human-like',
|
||
'ip.cad.mixed': 'Mixed',
|
||
'ip.cad.insufficient': 'Not enough data',
|
||
'ip.cad.automated.why': 'Fast and regular gaps between requests, typical of a tool or script.',
|
||
'ip.cad.human-like.why': 'Slow and irregular gaps, consistent with someone browsing by hand.',
|
||
'ip.cad.mixed.why': 'Neither clearly regular nor clearly manual: automation with pauses, or intense manual use.',
|
||
'ip.cad.insufficient.why': 'Too few requests to judge the rhythm ({n}).',
|
||
'ip.def.title': 'Defense',
|
||
'ip.def.bans': 'fail2ban history',
|
||
'ip.def.bans.empty': 'Never banned in this period.',
|
||
'ip.def.active': 'banned',
|
||
'ip.def.lifted': 'lifted {when}',
|
||
'ip.def.banAt': 'banned {when}',
|
||
'ip.def.ttb': 'Time to ban',
|
||
'ip.def.ttb.hint': 'From the first event to the first ban.',
|
||
'ip.def.ttb.none': 'not banned yet',
|
||
'ip.def.blocklist': 'Blocklist',
|
||
'ip.def.blocklist.yes': 'Listed since {when}',
|
||
'ip.def.blocklist.yes.nosince': 'Listed',
|
||
'ip.def.blocklist.no': 'Not on the exported blocklist',
|
||
'ip.tech.title': 'Techniques and families',
|
||
'ip.tech.hint': 'MITRE ATT&CK techniques inferred from what this IP requested.',
|
||
'ip.tech.mitre': 'MITRE ATT&CK',
|
||
'ip.tech.empty': 'No technique mapped yet.',
|
||
'ip.tech.count.one': '{n} time',
|
||
'ip.tech.count.other': '{n} times',
|
||
'ip.tech.span': '{a} to {b}',
|
||
'ip.tech.open': 'Open {id} on attack.mitre.org',
|
||
'ip.fam.title': 'Families of request',
|
||
'ip.fam.empty': 'No request family recorded.',
|
||
'ip.fam.examples': 'Example paths',
|
||
'ip.fam.more': 'Show {n} more',
|
||
'ip.fam.less': 'Show fewer',
|
||
'ip.fam.sensitive': 'answered 2xx on a sensitive family',
|
||
'ip.fam.events.one': '{n} event',
|
||
'ip.fam.events.other': '{n} events',
|
||
'ip.fam.status': 'Status of the answers',
|
||
'ip.fam.traversal': 'Path traversal',
|
||
'ip.fam.log4shell': 'Log4Shell',
|
||
'ip.fam.sqli': 'SQL injection',
|
||
'ip.fam.xss': 'XSS',
|
||
'ip.fam.rce-injection': 'Command injection',
|
||
'ip.fam.webshell': 'Web shell',
|
||
'ip.fam.env-credentials': 'Credential files',
|
||
'ip.fam.vcs': 'Version control files',
|
||
'ip.fam.backup': 'Backups and dumps',
|
||
'ip.fam.wordpress': 'WordPress',
|
||
'ip.fam.phpmyadmin-db': 'Database admin',
|
||
'ip.fam.actuator-debug': 'Debug endpoints',
|
||
'ip.fam.iot-cgi': 'IoT and CGI',
|
||
'ip.fam.admin-panel': 'Admin panels',
|
||
'ip.fam.generic-404': 'Generic probing',
|
||
'ip.fam.port-scan': 'Network port scan',
|
||
'ip.ses.title': 'Sessions',
|
||
'ip.ses.hint': 'Bursts of activity separated by quiet gaps.',
|
||
'ip.ses.empty': 'No session found in this period.',
|
||
'ip.ses.start': 'Start',
|
||
'ip.ses.duration': 'Duration',
|
||
'ip.ses.events': 'Events',
|
||
'ip.ses.stage': 'Highest stage',
|
||
'ip.ses.targets': 'Targets',
|
||
'ip.ses.cats': 'Categories',
|
||
'ip.ses.fams': 'Families',
|
||
'ip.ses.techs': 'Techniques',
|
||
'ip.ses.campaign': 'Campaign',
|
||
'ip.ses.replay': 'Replay session',
|
||
'ip.ses.success': 'access obtained',
|
||
'ip.ses.bannedAt': 'banned at {when}',
|
||
'ip.ses.showall': 'Show all {n} sessions',
|
||
'ip.ses.showless': 'Show fewer',
|
||
'ip.stage.recon': 'Recon',
|
||
'ip.stage.probe': 'Probe',
|
||
'ip.stage.exploit': 'Exploit',
|
||
'ip.stage.access': 'Access',
|
||
'ip.stage.banned': 'Banned',
|
||
'ip.stage.label': 'Highest stage reached: {stage}',
|
||
'ip.ev.title': 'Raw events',
|
||
'ip.ev.hint': 'Newest first.',
|
||
'ip.ev.time': 'Time',
|
||
'ip.ev.cat': 'Category',
|
||
'ip.ev.target': 'Target',
|
||
'ip.ev.request': 'Request',
|
||
'ip.ev.status': 'Status',
|
||
'ip.ev.bytes': 'Bytes',
|
||
'ip.ev.loading': 'Loading events.',
|
||
'ip.ev.empty': 'No raw events returned for this period.',
|
||
'ip.ev.unavailable': 'Raw events are not available right now.',
|
||
'ip.ev.disabled': 'The event log is turned off on this server, so raw events cannot be listed. The summary above still works.',
|
||
'ip.ev.shown': '{n} events shown',
|
||
'ip.ev.user': 'user {user}',
|
||
'ip.ev.ban': 'ban in {jail}',
|
||
'ip.ev.unban': 'unban in {jail}',
|
||
'ip.tg.title': 'Targets',
|
||
'ip.tg.hint': 'Which hosts and domains it went after.',
|
||
'ip.tg.empty': 'No target recorded.',
|
||
'ip.tg.domain': 'Domain',
|
||
'ip.tg.service': 'Service',
|
||
'ip.ssh.title': 'SSH credentials tried',
|
||
'ip.ssh.note': 'Passwords never appear in the log: only the user name is recorded.',
|
||
'ip.ssh.fails': '{n} failed logins',
|
||
'ip.ssh.empty': 'No SSH attempt from this IP.',
|
||
'ip.ssh.user': 'User',
|
||
'ip.ssh.first': 'First try',
|
||
'ip.ssh.real': 'real account',
|
||
'ip.ssh.real.hint': 'This is a user that exists on the server.',
|
||
'ip.ssh.okafter': 'logged in after failing',
|
||
'ip.cl.title': 'Clients',
|
||
'ip.cl.hint': 'What the attacker says it is. It is easy to fake.',
|
||
'ip.cl.uas': 'User agents',
|
||
'ip.cl.uas.empty': 'No user agent recorded.',
|
||
'ip.cl.labels': 'Recognized tools',
|
||
'ip.cl.labels.empty': 'No known attack tool recognized.',
|
||
'ip.cl.forged': 'Forged monitor user agent',
|
||
'ip.cl.forged.body': 'It pretends to be a legitimate uptime monitor. The label cannot be trusted.',
|
||
'ip.cl.rotation': 'User agent rotation',
|
||
'ip.cl.rotation.body': 'It changed user agent {n} times to look like different clients.',
|
||
'ip.cl.rotation.yes': 'It changes user agent between requests to look like different clients.',
|
||
'ip.cl.expand': 'Show all',
|
||
'ip.cl.collapse': 'Show less',
|
||
'ip.cl.status': 'Status of the answers',
|
||
'ip.cl.status.empty': 'No status recorded.',
|
||
'ip.cl.class.2': '2xx success',
|
||
'ip.cl.class.3': '3xx redirect',
|
||
'ip.cl.class.4': '4xx refused',
|
||
'ip.cl.class.5': '5xx server error',
|
||
'ip.rel.title': 'Relations',
|
||
'ip.rel.hint': 'Other sources that look connected to this one.',
|
||
'ip.rel.prefix': 'Active IPs in the same prefix',
|
||
'ip.rel.prefix.empty': 'No other active IP in this prefix.',
|
||
'ip.rel.asn': 'Other IPs in the same AS',
|
||
'ip.rel.asn.n.one': '{n} other IP in the same AS',
|
||
'ip.rel.asn.n.other': '{n} other IPs in the same AS',
|
||
'ip.rel.asn.none': 'No other IP seen in this AS.',
|
||
'ip.rel.campaigns': 'Campaigns',
|
||
'ip.rel.campaigns.empty': 'Not part of a detected campaign.',
|
||
'ip.rel.campaign.ips.one': '{n} IP',
|
||
'ip.rel.campaign.ips.other': '{n} IPs',
|
||
'ip.rel.open': 'Open analysis of {ip}',
|
||
'ip.sec.summary': 'Summary',
|
||
'ip.sec.attack': 'Targets & techniques',
|
||
'ip.sec.identity': 'Identity',
|
||
'ip.sec.events': 'Events',
|
||
'ip.q.what': 'What it did',
|
||
'ip.q.when': 'When',
|
||
'ip.q.against': 'Against',
|
||
'ip.q.blocked': 'Blocked?',
|
||
'ip.q.blocked.yes': 'Yes, on {hosts}',
|
||
'ip.q.blocked.no': 'No active ban',
|
||
'ip.q.blocked.list': 'on the exported blocklist',
|
||
'ip.q.last': 'last seen {ago}',
|
||
'ip.q.more': '+{n} more',
|
||
'ip.q.nothing': 'Nothing recorded in this period',
|
||
'ip.score.over': 'Raw score {n}; the scale is capped at 1000.',
|
||
'ip.def.hosts': 'Status per host',
|
||
'ip.def.host.on': 'banned by {jails}',
|
||
'ip.def.host.off': 'no active ban',
|
||
'ip.def.history': 'Ban history ({n})',
|
||
'ip.id.title': 'Identity and clients',
|
||
'ip.id.hint': 'Where it comes from and what it claims to be. Location is approximate; user agents are easy to forge.',
|
||
'ip.ev.filter': 'Show',
|
||
'ip.ev.filter.all': 'All categories',
|
||
'ip.ev.filter.none': 'No event of this category on this page.',
|
||
'ip.attack.hint': 'What it asked for, against which sites, and the MITRE ATT&CK techniques that implies.'
|
||
},
|
||
'pt-BR': {
|
||
'ip.title': 'Análise de IP',
|
||
'ip.back': 'IPs',
|
||
'ip.back.label': 'Voltar para a lista de IPs',
|
||
'ip.period': 'Período: {range}',
|
||
'ip.toc': 'Seções',
|
||
'ip.sec.verdict': 'Veredito',
|
||
'ip.sec.activity': 'Atividade',
|
||
'ip.sec.defense': 'Defesa',
|
||
'ip.sec.techniques': 'Técnicas',
|
||
'ip.sec.sessions': 'Sessões',
|
||
'ip.sec.targets': 'Alvos',
|
||
'ip.sec.clients': 'Clientes',
|
||
'ip.sec.related': 'Relações',
|
||
'ip.loading': 'Carregando a análise.',
|
||
'ip.invalid': 'Este não é um endereço IP válido.',
|
||
'ip.error': 'Não foi possível carregar este IP.',
|
||
'ip.notfound': 'Nenhuma atividade deste IP no período selecionado.',
|
||
'ip.notfound.hint': 'Escolha um período maior acima, ou o IP nunca foi visto.',
|
||
'ip.retry': 'Tentar de novo',
|
||
'ip.lead.hostile': 'Hostil: {events} {range}',
|
||
'ip.lead.suspicious': 'Suspeito: {events} {range}',
|
||
'ip.lead.low': 'Baixo risco: {events} {range}',
|
||
'ip.lead.admin': 'Administrador reconhecido: {events} {range}',
|
||
'ip.lead.none': 'Nenhum evento deste IP {range}',
|
||
'ip.lead.against.one': 'contra {n} domínio',
|
||
'ip.lead.against.other': 'contra {n} domínios',
|
||
'ip.lead.banned': 'banido por {jails}',
|
||
'ip.lead.bannedNow': 'banido agora',
|
||
'ip.n.events.one': '{n} evento',
|
||
'ip.n.events.other': '{n} eventos',
|
||
'ip.n.sessions.one': '{n} sessão',
|
||
'ip.n.sessions.other': '{n} sessões',
|
||
'ip.n.days.one': '{n} dia',
|
||
'ip.n.days.other': '{n} dias',
|
||
'ip.score': 'Pontuação',
|
||
'ip.score.of': 'de 1000',
|
||
'ip.score.label': 'Pontuação {n} de 1000',
|
||
'ip.level': 'Nível',
|
||
'ip.level.hostile': 'Hostil',
|
||
'ip.level.suspicious': 'Suspeito',
|
||
'ip.level.low': 'Baixo',
|
||
'ip.admin': 'Administrador',
|
||
'ip.confidence': 'Confiança',
|
||
'ip.confidence.high': 'alta: evidência forte',
|
||
'ip.confidence.medium': 'moderada: só sinais fracos',
|
||
'ip.confidence.admin': 'não se aplica (administrador)',
|
||
'ip.reasons': 'Por que este veredito',
|
||
'ip.reasons.empty': 'Nenhuma razão de pontuação foi informada para este IP.',
|
||
'ip.reasons.weight': 'peso',
|
||
'ip.reason.exploits_refused.one': '{n} tentativa de exploração foi recusada (4xx/5xx) em: {families}.',
|
||
'ip.reason.exploits_refused.other': '{n} tentativas de exploração foram recusadas (4xx/5xx) em: {families}.',
|
||
'ip.reason.tool_ua': 'Se identifica com uma ferramenta de ataque: {tool}.',
|
||
'ip.reason.banned_jail': 'Banido pelo fail2ban: {jails}.',
|
||
'ip.reason.multi_category.one': 'Visto em {n} categoria maliciosa.',
|
||
'ip.reason.multi_category.other': 'Visto em {n} categorias maliciosas diferentes.',
|
||
'ip.reason.exposure.one': 'Recebeu {n} resposta de sucesso (2xx) em um caminho sensível: {families}.',
|
||
'ip.reason.exposure.other': 'Recebeu {n} respostas de sucesso (2xx) em caminhos sensíveis: {families}.',
|
||
'ip.reason.ssh_login_after_bruteforce': 'Entrou por SSH depois de uma rodada de força bruta.',
|
||
'ip.reason.admin': 'Reconhecido como endereço de administrador (reduz a pontuação).',
|
||
'ip.reason.immune': 'Está na lista de permissão (imune a bans).',
|
||
'ip.reason.unknown': 'Sinal: {code}',
|
||
'ip.actions': 'Ações recomendadas',
|
||
'ip.actions.empty': 'Nenhuma ação recomendada.',
|
||
'ip.action.block': 'Bloquear este IP (firewall ou fail2ban).',
|
||
'ip.action.report': 'Denunciar ao dono da rede ou a uma base de abusos.',
|
||
'ip.action.keep_blocked': 'Manter bloqueado: já está banido e o ban continua ativo.',
|
||
'ip.action.replay': 'Ver o que ele fez, passo a passo, no Replay.',
|
||
'ip.score.cuts': 'Cortes: suspeito a partir de {a}, hostil a partir de {b}.',
|
||
'ip.score.rule.k': 'Hostil por regra:',
|
||
'ip.cl.interp': 'Clientes interpretados',
|
||
'ip.cl.status.fromEvents': 'Contado a partir dos {n} eventos carregados abaixo.',
|
||
'ip.nolog': 'Sem detalhe para listar: o registro de eventos não cobre este período, mas os contadores mostram {n} eventos.',
|
||
'ip.est': 'Estimado a partir dos contadores: o registro de eventos não cobre este período.',
|
||
'ip.ssh.counters': '{n} logins SSH falhos foram contados, mas os nomes de usuário não estão disponíveis neste período.',
|
||
'ip.def.noinfo': 'O histórico de bans deste período não está disponível.',
|
||
'ip.action.investigate': 'Investigar os dados expostos e os logs do servidor em torno das requisições bem-sucedidas.',
|
||
'ip.action.incident': 'Tratar como incidente: trocar os segredos expostos e revisar as contas afetadas.',
|
||
'ip.expo.title': 'CRÍTICO: o servidor respondeu com conteúdo em um caminho sensível',
|
||
'ip.expo.body': 'Estas requisições receberam resposta 2xx. O atacante pode ter o arquivo, então troque qualquer segredo que ele contenha.',
|
||
'ip.expo.path': 'Caminho',
|
||
'ip.expo.status': 'Status',
|
||
'ip.expo.size': 'Tamanho',
|
||
'ip.expo.host': 'Host',
|
||
'ip.expo.more': 'Mostrar mais {n}',
|
||
'ip.expo.less': 'Mostrar menos',
|
||
'ip.inc.title': 'INCIDENTE: login SSH bem-sucedido depois de tentativas falhas',
|
||
'ip.inc.body': 'Este endereço acertou uma credencial válida depois de falhar {n} vezes. Trate a conta como comprometida: encerre as sessões, troque as credenciais e veja o que ele executou.',
|
||
'ip.inc.body.nofails': 'Este endereço entrou por SSH depois de uma rodada de força bruta. Trate a conta como comprometida: encerre as sessões, troque as credenciais e veja o que ele executou.',
|
||
'ip.id.location': 'Localização',
|
||
'ip.id.approx': 'aprox.',
|
||
'ip.id.network': 'Rede',
|
||
'ip.id.rdns': 'DNS reverso',
|
||
'ip.id.rdns.none': 'sem DNS reverso',
|
||
'ip.id.fcrdns.ok': 'FCrDNS confere',
|
||
'ip.id.fcrdns.bad': 'FCrDNS não confere',
|
||
'ip.id.fcrdns.hint': 'DNS reverso confirmado: o nome resolve de volta para este endereço.',
|
||
'ip.id.nettype': 'Tipo de rede',
|
||
'ip.id.prefix': 'Prefixo',
|
||
'ip.id.unknown': 'desconhecido',
|
||
'ip.nt.tor': 'Saída Tor',
|
||
'ip.nt.vpn': 'VPN',
|
||
'ip.nt.research-scanner': 'Scanner de pesquisa',
|
||
'ip.nt.isp-cn': 'Operadora chinesa',
|
||
'ip.nt.hosting': 'Hospedagem',
|
||
'ip.nt.mobile': 'Celular',
|
||
'ip.nt.isp-mobile': 'Operadora / celular',
|
||
'ip.nt.residential': 'Residencial',
|
||
'ip.nt.unknown': 'Desconhecido',
|
||
'ip.ntr.asn': 'ASN {v} conhecido',
|
||
'ip.ntr.asorg': 'o nome da organização contém "{v}"',
|
||
'ip.ntr.rdns': 'o DNS reverso contém "{v}"',
|
||
'ip.ntr.tor': 'listado como nó de saída Tor',
|
||
'ip.untrusted': 'texto enviado pelo atacante',
|
||
'ip.act.copy': 'Copiar IP',
|
||
'ip.act.ioc': 'Copiar como IOC',
|
||
'ip.act.json': 'Exportar JSON',
|
||
'ip.act.stix': 'STIX 2.1',
|
||
'ip.act.replay': 'Reproduzir este IP',
|
||
'ip.act.copied': 'Copiado.',
|
||
'ip.act.copyfail': 'Não foi possível copiar.',
|
||
'ip.ext.title': 'Consultar em outro lugar',
|
||
'ip.ext.note': 'Abre em outra aba. Nada é enviado até você clicar.',
|
||
'ip.ext.abuseipdb': 'AbuseIPDB',
|
||
'ip.ext.greynoise': 'GreyNoise',
|
||
'ip.ext.shodan': 'Shodan',
|
||
'ip.ext.censys': 'Censys',
|
||
'ip.ext.virustotal': 'VirusTotal',
|
||
'ip.ext.bgphe': 'bgp.he.net',
|
||
'ip.ext.ripestat': 'RIPEstat',
|
||
'ip.ext.out': '(abre outro site)',
|
||
'ip.tl.title': 'Eventos por hora',
|
||
'ip.tl.hint': 'Empilhados por categoria. As marcas verticais são bans do fail2ban.',
|
||
'ip.tl.peak': 'Pico: {n} por hora, {when}',
|
||
'ip.tl.empty': 'Sem série por hora neste período.',
|
||
'ip.tl.ban': 'ban',
|
||
'ip.tl.unban': 'desban',
|
||
'ip.tl.tip': '{when}: {n}',
|
||
'ip.hm.title': 'Quando age',
|
||
'ip.hm.hint': 'Eventos por dia da semana e hora (UTC) no período selecionado. Horário fixo sugere automação ou um fuso.',
|
||
'ip.hm.less': 'menos',
|
||
'ip.hm.more': 'mais',
|
||
'ip.hm.tip': '{day} {hour}h UTC: {n}',
|
||
'ip.hm.empty': 'Poucos dados por hora para um mapa de calor.',
|
||
'ip.time.title': 'Tempo',
|
||
'ip.time.first': 'Primeira vez',
|
||
'ip.time.last': 'Última vez',
|
||
'ip.time.active': 'Dias ativos',
|
||
'ip.time.sessions': 'Sessões',
|
||
'ip.time.returning': 'Volta',
|
||
'ip.time.returning.yes': 'Sim, voltou depois de um período quieto',
|
||
'ip.time.returning.no': 'Não, uma visita só',
|
||
'ip.cad.title': 'Cadência',
|
||
'ip.cad.median': 'Intervalo mediano',
|
||
'ip.cad.spread': 'p10 a p90',
|
||
'ip.cad.cv': 'CV',
|
||
'ip.cad.cv.hint': 'Coeficiente de variação dos intervalos. Perto de 0 é metronômico.',
|
||
'ip.cad.burst': 'Rajada máxima',
|
||
'ip.cad.burst.unit': 'em 60 s',
|
||
'ip.cad.n': 'Requisições medidas',
|
||
'ip.cad.automated': 'Automatizado',
|
||
'ip.cad.human-like': 'Parece humano',
|
||
'ip.cad.mixed': 'Misto',
|
||
'ip.cad.insufficient': 'Dados insuficientes',
|
||
'ip.cad.automated.why': 'Intervalos rápidos e regulares entre requisições, típicos de ferramenta ou script.',
|
||
'ip.cad.human-like.why': 'Intervalos lentos e irregulares, compatíveis com alguém navegando à mão.',
|
||
'ip.cad.mixed.why': 'Nem claramente regular nem claramente manual: automação com pausas, ou uso manual intenso.',
|
||
'ip.cad.insufficient.why': 'Poucas requisições para julgar o ritmo ({n}).',
|
||
'ip.def.title': 'Defesa',
|
||
'ip.def.bans': 'Histórico do fail2ban',
|
||
'ip.def.bans.empty': 'Nunca foi banido neste período.',
|
||
'ip.def.active': 'banido',
|
||
'ip.def.lifted': 'liberado {when}',
|
||
'ip.def.banAt': 'banido {when}',
|
||
'ip.def.ttb': 'Tempo até o ban',
|
||
'ip.def.ttb.hint': 'Do primeiro evento ao primeiro ban.',
|
||
'ip.def.ttb.none': 'ainda não banido',
|
||
'ip.def.blocklist': 'Lista de bloqueio',
|
||
'ip.def.blocklist.yes': 'Listado desde {when}',
|
||
'ip.def.blocklist.yes.nosince': 'Listado',
|
||
'ip.def.blocklist.no': 'Fora da lista de bloqueio exportada',
|
||
'ip.tech.title': 'Técnicas e famílias',
|
||
'ip.tech.hint': 'Técnicas MITRE ATT&CK inferidas do que este IP pediu.',
|
||
'ip.tech.mitre': 'MITRE ATT&CK',
|
||
'ip.tech.empty': 'Nenhuma técnica mapeada ainda.',
|
||
'ip.tech.count.one': '{n} vez',
|
||
'ip.tech.count.other': '{n} vezes',
|
||
'ip.tech.span': '{a} até {b}',
|
||
'ip.tech.open': 'Abrir {id} em attack.mitre.org',
|
||
'ip.fam.title': 'Famílias de requisição',
|
||
'ip.fam.empty': 'Nenhuma família de requisição registrada.',
|
||
'ip.fam.examples': 'Caminhos de exemplo',
|
||
'ip.fam.more': 'Mostrar mais {n}',
|
||
'ip.fam.less': 'Mostrar menos',
|
||
'ip.fam.sensitive': 'respondeu 2xx em família sensível',
|
||
'ip.fam.events.one': '{n} evento',
|
||
'ip.fam.events.other': '{n} eventos',
|
||
'ip.fam.status': 'Status das respostas',
|
||
'ip.fam.traversal': 'Travessia de caminho',
|
||
'ip.fam.log4shell': 'Log4Shell',
|
||
'ip.fam.sqli': 'Injeção de SQL',
|
||
'ip.fam.xss': 'XSS',
|
||
'ip.fam.rce-injection': 'Injeção de comando',
|
||
'ip.fam.webshell': 'Web shell',
|
||
'ip.fam.env-credentials': 'Arquivos de credenciais',
|
||
'ip.fam.vcs': 'Arquivos de controle de versão',
|
||
'ip.fam.backup': 'Backups e dumps',
|
||
'ip.fam.wordpress': 'WordPress',
|
||
'ip.fam.phpmyadmin-db': 'Administração de banco',
|
||
'ip.fam.actuator-debug': 'Endpoints de depuração',
|
||
'ip.fam.iot-cgi': 'IoT e CGI',
|
||
'ip.fam.admin-panel': 'Painéis de administração',
|
||
'ip.fam.generic-404': 'Sondagem genérica',
|
||
'ip.fam.port-scan': 'Varredura de portas de rede',
|
||
'ip.ses.title': 'Sessões',
|
||
'ip.ses.hint': 'Rajadas de atividade separadas por intervalos quietos.',
|
||
'ip.ses.empty': 'Nenhuma sessão encontrada neste período.',
|
||
'ip.ses.start': 'Início',
|
||
'ip.ses.duration': 'Duração',
|
||
'ip.ses.events': 'Eventos',
|
||
'ip.ses.stage': 'Estágio máximo',
|
||
'ip.ses.targets': 'Alvos',
|
||
'ip.ses.cats': 'Categorias',
|
||
'ip.ses.fams': 'Famílias',
|
||
'ip.ses.techs': 'Técnicas',
|
||
'ip.ses.campaign': 'Campanha',
|
||
'ip.ses.replay': 'Reproduzir sessão',
|
||
'ip.ses.success': 'acesso obtido',
|
||
'ip.ses.bannedAt': 'banido às {when}',
|
||
'ip.ses.showall': 'Mostrar as {n} sessões',
|
||
'ip.ses.showless': 'Mostrar menos',
|
||
'ip.stage.recon': 'Recon.',
|
||
'ip.stage.probe': 'Sondagem',
|
||
'ip.stage.exploit': 'Exploração',
|
||
'ip.stage.access': 'Acesso',
|
||
'ip.stage.banned': 'Banido',
|
||
'ip.stage.label': 'Estágio máximo alcançado: {stage}',
|
||
'ip.ev.title': 'Eventos brutos',
|
||
'ip.ev.hint': 'Do mais novo para o mais antigo.',
|
||
'ip.ev.time': 'Hora',
|
||
'ip.ev.cat': 'Categoria',
|
||
'ip.ev.target': 'Alvo',
|
||
'ip.ev.request': 'Requisição',
|
||
'ip.ev.status': 'Status',
|
||
'ip.ev.bytes': 'Bytes',
|
||
'ip.ev.loading': 'Carregando eventos.',
|
||
'ip.ev.empty': 'Nenhum evento bruto retornado para este período.',
|
||
'ip.ev.unavailable': 'Os eventos brutos não estão disponíveis agora.',
|
||
'ip.ev.disabled': 'O registro de eventos está desligado neste servidor, então os eventos brutos não podem ser listados. O resumo acima continua valendo.',
|
||
'ip.ev.shown': '{n} eventos exibidos',
|
||
'ip.ev.user': 'usuário {user}',
|
||
'ip.ev.ban': 'ban em {jail}',
|
||
'ip.ev.unban': 'desban em {jail}',
|
||
'ip.tg.title': 'Alvos',
|
||
'ip.tg.hint': 'Quais hosts e domínios ele atacou.',
|
||
'ip.tg.empty': 'Nenhum alvo registrado.',
|
||
'ip.tg.domain': 'Domínio',
|
||
'ip.tg.service': 'Serviço',
|
||
'ip.ssh.title': 'Credenciais SSH tentadas',
|
||
'ip.ssh.note': 'As senhas nunca aparecem no log: só o nome de usuário é registrado.',
|
||
'ip.ssh.fails': '{n} logins falhos',
|
||
'ip.ssh.empty': 'Nenhuma tentativa SSH deste IP.',
|
||
'ip.ssh.user': 'Usuário',
|
||
'ip.ssh.first': 'Primeira tentativa',
|
||
'ip.ssh.real': 'conta real',
|
||
'ip.ssh.real.hint': 'Este usuário existe no servidor.',
|
||
'ip.ssh.okafter': 'entrou depois de falhar',
|
||
'ip.cl.title': 'Clientes',
|
||
'ip.cl.hint': 'O que o atacante diz que é. É fácil de falsificar.',
|
||
'ip.cl.uas': 'User agents',
|
||
'ip.cl.uas.empty': 'Nenhum user agent registrado.',
|
||
'ip.cl.labels': 'Ferramentas reconhecidas',
|
||
'ip.cl.labels.empty': 'Nenhuma ferramenta de ataque conhecida reconhecida.',
|
||
'ip.cl.forged': 'User agent de monitor forjado',
|
||
'ip.cl.forged.body': 'Finge ser um monitor de disponibilidade legítimo. O rótulo não é confiável.',
|
||
'ip.cl.rotation': 'Rotação de user agent',
|
||
'ip.cl.rotation.body': 'Trocou de user agent {n} vezes para parecer clientes diferentes.',
|
||
'ip.cl.rotation.yes': 'Troca de user agent entre requisições para parecer clientes diferentes.',
|
||
'ip.cl.expand': 'Mostrar tudo',
|
||
'ip.cl.collapse': 'Mostrar menos',
|
||
'ip.cl.status': 'Status das respostas',
|
||
'ip.cl.status.empty': 'Nenhum status registrado.',
|
||
'ip.cl.class.2': '2xx sucesso',
|
||
'ip.cl.class.3': '3xx redirecionamento',
|
||
'ip.cl.class.4': '4xx recusado',
|
||
'ip.cl.class.5': '5xx erro do servidor',
|
||
'ip.rel.title': 'Relações',
|
||
'ip.rel.hint': 'Outras fontes que parecem ligadas a esta.',
|
||
'ip.rel.prefix': 'IPs ativos no mesmo prefixo',
|
||
'ip.rel.prefix.empty': 'Nenhum outro IP ativo neste prefixo.',
|
||
'ip.rel.asn': 'Outros IPs no mesmo AS',
|
||
'ip.rel.asn.n.one': '{n} outro IP no mesmo AS',
|
||
'ip.rel.asn.n.other': '{n} outros IPs no mesmo AS',
|
||
'ip.rel.asn.none': 'Nenhum outro IP visto neste AS.',
|
||
'ip.rel.campaigns': 'Campanhas',
|
||
'ip.rel.campaigns.empty': 'Não faz parte de uma campanha detectada.',
|
||
'ip.rel.campaign.ips.one': '{n} IP',
|
||
'ip.rel.campaign.ips.other': '{n} IPs',
|
||
'ip.rel.open': 'Abrir a análise de {ip}',
|
||
'ip.sec.summary': 'Resumo',
|
||
'ip.sec.attack': 'Alvos e técnicas',
|
||
'ip.sec.identity': 'Identidade',
|
||
'ip.sec.events': 'Eventos',
|
||
'ip.q.what': 'O que fez',
|
||
'ip.q.when': 'Quando',
|
||
'ip.q.against': 'Contra o quê',
|
||
'ip.q.blocked': 'Está bloqueado?',
|
||
'ip.q.blocked.yes': 'Sim, em {hosts}',
|
||
'ip.q.blocked.no': 'Sem ban ativo',
|
||
'ip.q.blocked.list': 'na lista de bloqueio exportada',
|
||
'ip.q.last': 'última vez {ago}',
|
||
'ip.q.more': '+{n}',
|
||
'ip.q.nothing': 'Nada registrado neste período',
|
||
'ip.score.over': 'Pontuação bruta {n}; a escala vai até 1000.',
|
||
'ip.def.hosts': 'Situação por host',
|
||
'ip.def.host.on': 'banido por {jails}',
|
||
'ip.def.host.off': 'sem ban ativo',
|
||
'ip.def.history': 'Histórico de bans ({n})',
|
||
'ip.id.title': 'Identidade e clientes',
|
||
'ip.id.hint': 'De onde vem e o que diz ser. A localização é aproximada; user agents são fáceis de falsificar.',
|
||
'ip.ev.filter': 'Mostrar',
|
||
'ip.ev.filter.all': 'Todas as categorias',
|
||
'ip.ev.filter.none': 'Nenhum evento desta categoria nesta página.',
|
||
'ip.attack.hint': 'O que pediu, contra quais sites, e as técnicas MITRE ATT&CK que isso indica.'
|
||
}
|
||
});
|
||
|
||
// ---------------------------------------------------------------- helpers
|
||
var t = U.t, pl = U.pl, el = U.el, fmt = U.fmt || {};
|
||
// h(tag, class, [attrs], ...children): attrs is an optional plain object right after the class
|
||
function h(tag, cls) {
|
||
var attrs = cls ? { class: cls } : {}, i = 2, a;
|
||
var x = arguments[2];
|
||
if (x && typeof x === 'object' && !Array.isArray(x) && !(x instanceof Node)) {
|
||
Object.keys(x).forEach(function (k) { attrs[k] = x[k]; });
|
||
i = 3;
|
||
}
|
||
a = [tag, attrs];
|
||
for (; i < arguments.length; i++) a.push(arguments[i]);
|
||
return el.apply(null, a);
|
||
}
|
||
function clear(n) { while (n.firstChild) n.removeChild(n.firstChild); }
|
||
function lang() { return document.documentElement.lang || undefined; }
|
||
function N(n) { return fmt.num ? fmt.num(n) : String(n); }
|
||
function isObj(v) { return v && typeof v === 'object' && !Array.isArray(v); }
|
||
function arr(v) { return Array.isArray(v) ? v : []; }
|
||
function has(v) { return v !== undefined && v !== null; }
|
||
function num(v) { v = Number(v); return isFinite(v) ? v : 0; }
|
||
function pick(list, v, fb) { return list.indexOf(v) >= 0 ? v : fb; }
|
||
function str(v) { return has(v) ? String(v) : ''; }
|
||
function clip(s, n) { s = str(s); return s.length > n ? s.slice(0, n - 1) + '…' : s; }
|
||
|
||
function ts(v) {
|
||
if (!has(v) || v === '') return 0;
|
||
if (typeof v === 'number') return v > 1e12 ? v / 1000 : v;
|
||
if (typeof v === 'string') {
|
||
if (/^\d+(\.\d+)?$/.test(v)) { var n = +v; return n > 1e12 ? n / 1000 : n; }
|
||
var p = Date.parse(v);
|
||
return isNaN(p) || p <= 0 ? 0 : p / 1000;
|
||
}
|
||
return 0;
|
||
}
|
||
function dt(s) {
|
||
if (!s) return '-';
|
||
try { return new Date(s * 1000).toLocaleString(lang(), { dateStyle: 'short', timeStyle: 'medium' }); } catch (e) { return new Date(s * 1000).toLocaleString(); }
|
||
}
|
||
function dShort(s) {
|
||
try { return new Date(s * 1000).toLocaleString(lang(), { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' }); } catch (e) { return String(s); }
|
||
}
|
||
function ago(s) { return s && fmt.ago ? fmt.ago(s) : ''; }
|
||
function dur(s) {
|
||
s = num(s);
|
||
if (s < 1) return s > 0 ? '<1 s' : '0 s';
|
||
if (s < 10) return (Math.round(s * 10) / 10) + ' s';
|
||
if (s < 60) return Math.round(s) + ' s';
|
||
if (s < 3600) { var m = Math.floor(s / 60), r = Math.round(s % 60); return m + ' min' + (r ? ' ' + r + ' s' : ''); }
|
||
if (s < 86400) { var hh = Math.floor(s / 3600), mm = Math.round((s % 3600) / 60); return hh + ' h' + (mm ? ' ' + mm + ' min' : ''); }
|
||
var d = Math.floor(s / 86400), hr = Math.round((s % 86400) / 3600);
|
||
return d + ' d' + (hr ? ' ' + hr + ' h' : '');
|
||
}
|
||
function bytes(n) { return fmt.bytes ? fmt.bytes(num(n)) : N(num(n)) + ' B'; }
|
||
function keyOf(x) { return typeof x === 'string' ? x : isObj(x) ? str(x.label || x.key || x.ua) : ''; }
|
||
function entries(m) {
|
||
var out = [];
|
||
if (Array.isArray(m)) m.forEach(function (k) { if (typeof k === 'string') out.push([k, 0]); else if (isObj(k) && has(k.name)) out.push([String(k.name), num(k.n)]); });
|
||
else if (isObj(m)) Object.keys(m).forEach(function (k) { out.push([k, num(m[k])]); });
|
||
return out.sort(function (a, b) { return b[1] - a[1]; });
|
||
}
|
||
function svg(tag, attrs) { var a = attrs || {}; return el.apply(null, [tag, a].concat(Array.prototype.slice.call(arguments, 2))); }
|
||
|
||
var IP4 = /^\d{1,3}(\.\d{1,3}){3}$/, IP6 = /^[0-9a-fA-F:.]{2,45}$/;
|
||
function validIP(s) {
|
||
s = str(s);
|
||
if (IP4.test(s)) return s.split('.').every(function (o) { return +o <= 255; });
|
||
return IP6.test(s) && s.indexOf(':') >= 0 && s.length <= 45;
|
||
}
|
||
function ipFromCtx(ctx) {
|
||
var p = ctx && ctx.params, v = '';
|
||
if (typeof p === 'string') v = p;
|
||
else if (Array.isArray(p)) v = p[0];
|
||
else if (isObj(p)) v = (Array.isArray(p.segments) && p.segments[0]) || (Array.isArray(p.path) && p.path[0]) || p.ip || p.id || p[0] || '';
|
||
if (!v) {
|
||
var m = /^#\/ip\/([^?#]+)/.exec(location.hash || '');
|
||
v = m ? m[1] : '';
|
||
}
|
||
try { v = decodeURIComponent(String(v)); } catch (e) { v = String(v); }
|
||
return v;
|
||
}
|
||
|
||
// range handling with a fallback for shells that predate rangeParams()
|
||
function rParams(ctx) {
|
||
var r = typeof U.rangeParams === 'function' ? U.rangeParams() : null;
|
||
if (isObj(r)) return r;
|
||
return { range: (ctx && ctx.range) || '24h' };
|
||
}
|
||
function rLabel(ctx) {
|
||
if (typeof U.rangeLabel === 'function') { var l = U.rangeLabel(); if (l) return String(l); }
|
||
return t('range.long.' + pick(['1h', '24h', '7d'], ctx && ctx.range, '24h'));
|
||
}
|
||
function rInline(ctx) {
|
||
if (typeof U.rangeLabel === 'function') { var l = U.rangeLabel({ inline: true }); if (l) return String(l); }
|
||
return rLabel(ctx);
|
||
}
|
||
function qs(obj) {
|
||
var o = [];
|
||
Object.keys(obj).forEach(function (k) { if (has(obj[k]) && obj[k] !== '') o.push(encodeURIComponent(k) + '=' + encodeURIComponent(String(obj[k]))); });
|
||
return o.join('&');
|
||
}
|
||
|
||
var KNOWN_CATS = ['ok', 'notfound', 'scanner', 'exploit', 'bruteforce', 'ssh-fail', 'ssh-probe', 'ssh-ok', 'ban'];
|
||
var STACK = ['notfound', 'ok', 'scanner', 'bruteforce', 'ssh-probe', 'ssh-fail', 'ssh-ok', 'exploit'];
|
||
var LEVELS = ['hostile', 'suspicious', 'low'];
|
||
var LEVEL_TONE = { hostile: 'danger', suspicious: 'warn', low: 'info' };
|
||
var STAGES = ['recon', 'probe', 'exploit', 'access', 'banned'];
|
||
var FAMS = ['traversal', 'log4shell', 'sqli', 'xss', 'rce-injection', 'webshell', 'env-credentials', 'vcs', 'backup', 'wordpress', 'phpmyadmin-db', 'actuator-debug', 'iot-cgi', 'admin-panel', 'generic-404', 'port-scan'];
|
||
var SENSITIVE = ['traversal', 'webshell', 'env-credentials', 'vcs', 'backup', 'phpmyadmin-db', 'actuator-debug'];
|
||
var NETTYPES = ['tor', 'vpn', 'research-scanner', 'isp-cn', 'hosting', 'mobile', 'isp/mobile', 'residential', 'unknown'];
|
||
var NT_TONE = { tor: 'danger', vpn: 'warn', 'research-scanner': 'info', 'isp-cn': 'warn', hosting: 'warn', mobile: 'info', 'isp/mobile': 'info', residential: 'info', unknown: 'neutral' };
|
||
var CADENCE = ['automated', 'human-like', 'mixed', 'insufficient'];
|
||
var CAD_TONE = { automated: 'danger', 'human-like': 'ok', mixed: 'warn', insufficient: 'neutral' };
|
||
var ACTIONS = ['incident', 'investigate', 'block', 'keep_blocked', 'report', 'replay'];
|
||
var ACTION_TONE = { incident: 'danger', investigate: 'warn', block: 'warn', keep_blocked: 'warn', report: 'info', replay: 'info' };
|
||
|
||
function famLabel(f) { f = str(f); return FAMS.indexOf(f) >= 0 ? t('ip.fam.' + f) : clip(f, 40); }
|
||
function catLabel(c) { return KNOWN_CATS.indexOf(c) >= 0 ? t('cat.' + c) : clip(c, 24); }
|
||
function levelOf(v) { return pick(LEVELS, v, 'low'); }
|
||
function score1000(v) {
|
||
v = num(v);
|
||
if (v > 0 && v < 1) v *= 1000;
|
||
return Math.max(0, Math.min(1000, Math.round(v)));
|
||
}
|
||
|
||
function badge(text, tone, extra) { return h('span', 'ipx-badge tone-' + pick(['danger', 'warn', 'ok', 'info', 'neutral'], tone, 'neutral') + (extra ? ' ' + extra : ''), text); }
|
||
function icoExit() { return svg('svg', { viewBox: '0 0 24 24', class: 'ipx-ico', 'aria-hidden': 'true', focusable: 'false' }, svg('path', { d: 'M7 17L17 7M9 7h8v8' })); }
|
||
function toast(msg) { if (typeof U.toast === 'function') U.toast(msg); }
|
||
|
||
function copyText(text) {
|
||
function ok() { toast(t('ip.act.copied')); }
|
||
function fail() { toast(t('ip.act.copyfail')); }
|
||
if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(text).then(ok, fail); return; }
|
||
try {
|
||
var ta = document.createElement('textarea');
|
||
ta.value = text; ta.setAttribute('readonly', ''); ta.className = 'ipx-offscreen';
|
||
document.body.appendChild(ta); ta.select();
|
||
var done = document.execCommand('copy');
|
||
document.body.removeChild(ta);
|
||
done ? ok() : fail();
|
||
} catch (e) { fail(); }
|
||
}
|
||
function download(name, mime, text) {
|
||
var blob = new Blob([text], { type: mime }), url = URL.createObjectURL(blob);
|
||
var a = document.createElement('a');
|
||
a.href = url; a.download = name;
|
||
document.body.appendChild(a); a.click(); document.body.removeChild(a);
|
||
setTimeout(function () { URL.revokeObjectURL(url); }, 4000);
|
||
}
|
||
function fileSlug(ip) { return ip.replace(/[^0-9a-fA-F.]/g, '-'); }
|
||
|
||
// text that came from the attacker: marked, wrapped, never interpreted
|
||
function untrusted(text, cls) { return h('span', 'untrusted ipx-untrusted ipx-mono ' + (cls || ''), str(text)); }
|
||
|
||
function emptyState(text, hint) {
|
||
return h('div', 'state-empty ipx-empty', h('p', 'ipx-empty-t', text), hint ? h('p', 'ipx-empty-h', hint) : null);
|
||
}
|
||
|
||
// ---------------------------------------------------------------- external links (built here, host fixed)
|
||
function extLinks(ip, asn) {
|
||
var out = [
|
||
['abuseipdb', 'https://www.abuseipdb.com/check/' + ip],
|
||
['greynoise', 'https://viz.greynoise.io/ip/' + ip],
|
||
['shodan', 'https://www.shodan.io/host/' + ip],
|
||
['censys', 'https://search.censys.io/hosts/' + ip],
|
||
['virustotal', 'https://www.virustotal.com/gui/ip-address/' + ip],
|
||
['bgphe', 'https://bgp.he.net/ip/' + ip],
|
||
['ripestat', 'https://stat.ripe.net/' + ip]
|
||
];
|
||
return out;
|
||
}
|
||
function mitreURL(id) {
|
||
var m = /^(T\d{4})(?:\.(\d{3}))?$/.exec(str(id));
|
||
if (!m) return '';
|
||
return 'https://attack.mitre.org/techniques/' + m[1] + '/' + (m[2] ? m[2] + '/' : '');
|
||
}
|
||
|
||
// ---------------------------------------------------------------- page state
|
||
var S = null;
|
||
function newState(root, ctx) {
|
||
return { root: root, ctx: ctx, ip: '', data: null, seq: 0, alive: true, lang: ctx.lang, key: '', cleanup: [], ev: { rows: [], cursor: '', loading: false, failed: false, loaded: false, seq: 0 }, evBox: null, evSeq: 0 };
|
||
}
|
||
function ctxKey(ctx) {
|
||
var p = rParams(ctx);
|
||
return [ipFromCtx(ctx), JSON.stringify(p), ctx.range, ctx.host, ctx.domain].join('|');
|
||
}
|
||
function dispose(s) {
|
||
s.cleanup.forEach(function (f) { try { f(); } catch (e) { /* ignore */ } });
|
||
s.cleanup = [];
|
||
}
|
||
|
||
// ---------------------------------------------------------------- section scaffolding
|
||
var uid = 0;
|
||
function card(titleKey, hintKey, span, cls) {
|
||
var id = 'ipx-h' + (++uid);
|
||
var body = h('div', 'ipx-cb');
|
||
var head = h('header', 'ipx-ch', h('h2', 'ipx-h2', { id: id }, t(titleKey)));
|
||
head.firstChild.setAttribute('id', id);
|
||
if (hintKey) head.appendChild(h('p', 'ipx-hint', t(hintKey)));
|
||
var node = h('section', 'ipx-card ipx-s' + span + (cls ? ' ' + cls : ''), head, body);
|
||
node.setAttribute('aria-labelledby', id);
|
||
return { node: node, body: body };
|
||
}
|
||
function sub(titleKey, hintKey) {
|
||
return h('div', 'ipx-subh', h('h3', 'ipx-h3', t(titleKey)), hintKey ? h('p', 'ipx-hint', t(hintKey)) : null);
|
||
}
|
||
function safe(fn) { try { return fn(); } catch (e) { if (window.console) console.error('ip page:', e); return null; } }
|
||
|
||
// ---------------------------------------------------------------- A: verdict
|
||
function normalizeVerdict(d) {
|
||
var v = isObj(d.verdict) ? d.verdict : {};
|
||
return {
|
||
level: levelOf(has(v.level) ? v.level : d.level),
|
||
score: score1000(has(v.score) ? v.score : d.score),
|
||
raw: num(has(v.score) ? v.score : d.score),
|
||
strong: !!v.strong,
|
||
admin: !!v.admin,
|
||
reasons: arr(v.reasons).filter(isObj)
|
||
};
|
||
}
|
||
function totalEvents(d) {
|
||
var n = 0, c = isObj(d.counts) ? d.counts : null;
|
||
if (c) Object.keys(c).forEach(function (k) { n += num(c[k]); });
|
||
if (!n && Array.isArray(d.sessions)) d.sessions.forEach(function (s) { n += num(s && s.n); });
|
||
return n;
|
||
}
|
||
function domainCount(d) {
|
||
var set = {};
|
||
arr(d.targets).forEach(function (x) { if (x && x.domain) set[x.domain] = 1; });
|
||
var n = Object.keys(set).length;
|
||
return n || arr(d.domains).length;
|
||
}
|
||
function counters(d, name) { return d && (d[name + '_source'] === 'counters' || d.source === 'counters'); }
|
||
function estNote(d, name) { return counters(d, name) ? h('p', 'ipx-faint ipx-est', t('ip.est')) : null; }
|
||
function nologText(d) { return t('ip.nolog', { n: N(totalEvents(d)) }); }
|
||
function cnt(d, k) { return isObj(d.counts) ? num(d.counts[k]) : 0; }
|
||
// one coherent view of the bans: the history plus any ban that is active now
|
||
function banList(d) {
|
||
var raw = arr(has(d.bans) ? d.bans : d.ban_history).filter(isObj);
|
||
var list = raw.map(function (x) { return { jail: x.jail, host: str(x.host), t: ts(x.t), unban: ts(x.unban), active: x.active === true || (x.active === undefined && !ts(x.unban)) }; });
|
||
var anyActive = list.some(function (x) { return x.active; });
|
||
if (d.banned && !anyActive) {
|
||
var js = arr(d.jails).filter(function (j) { return typeof j === 'string'; });
|
||
(js.length ? js : ['']).forEach(function (j) { list.push({ jail: j, t: 0, unban: 0, active: true, synthetic: true }); });
|
||
}
|
||
return list;
|
||
}
|
||
function isBanned(d) { return !!d.banned || banList(d).some(function (x) { return x.active; }); }
|
||
function jailNames(d) {
|
||
var set = {}, out = [];
|
||
arr(d.jails).forEach(function (j) { if (typeof j === 'string') set[j] = 1; });
|
||
banList(d).forEach(function (b) { if (b.jail && b.active) set[b.jail] = 1; });
|
||
Object.keys(set).forEach(function (k) { out.push(k); });
|
||
return out;
|
||
}
|
||
function leadText(d, v, ctx) {
|
||
var ev = totalEvents(d), range = rInline(ctx);
|
||
if (!ev) return t('ip.lead.none', { range: range });
|
||
var key = v.admin ? 'ip.lead.admin' : 'ip.lead.' + v.level;
|
||
var s = t(key, { events: pl('ip.n.events', ev), range: range });
|
||
var dn = domainCount(d);
|
||
if (dn) s += ' ' + pl('ip.lead.against', dn);
|
||
var jails = jailNames(d);
|
||
if (isBanned(d)) s += jails.length ? ', ' + t('ip.lead.banned', { jails: jails.slice(0, 3).join(', ') }) : ', ' + t('ip.lead.bannedNow');
|
||
return s;
|
||
}
|
||
function reasonText(r) {
|
||
var code = str(r.code), p = isObj(r.params) ? r.params : {};
|
||
var known = ['exploits_refused', 'tool_ua', 'banned_jail', 'multi_category', 'exposure', 'ssh_login_after_bruteforce', 'admin', 'immune'];
|
||
var PLURAL = ['exploits_refused', 'multi_category', 'exposure'];
|
||
var nn = num(has(p.n) ? p.n : r.n);
|
||
var fams = str(p.families).split(',').map(function (x) { return x.trim(); }).filter(Boolean).map(famLabel).join(', ');
|
||
if (known.indexOf(code) >= 0) {
|
||
var vars = { n: N(nn), families: fams || '-', tool: clip(p.tool, 80) || '-', jails: clip(p.jails, 80).split(',').map(function (x) { return x.trim(); }).join(', ') || '-' };
|
||
var rk = 'ip.reason.' + code;
|
||
return PLURAL.indexOf(code) >= 0 ? pl(rk, nn, vars) : t(rk, vars);
|
||
}
|
||
if (/^intel\.reason\.[a-z0-9_]+$/.test(str(r.text))) {
|
||
var sp = {};
|
||
Object.keys(p).forEach(function (k) { sp[k] = clip(p[k], 120); });
|
||
sp.n = N(nn); if (fams) sp.families = fams;
|
||
var srv = t(r.text, sp);
|
||
if (srv !== r.text) return srv;
|
||
}
|
||
return t('ip.reason.unknown', { code: clip(code, 40) });
|
||
}
|
||
function weightPts(w) { w = num(w); return Math.round(Math.abs(w) <= 1 ? w * 100 : w); }
|
||
|
||
function reasonsBlock(v) {
|
||
var box = h('div', 'ipx-block');
|
||
box.appendChild(h('h3', 'ipx-h3', t('ip.reasons')));
|
||
if (!v.reasons.length) { box.appendChild(h('p', 'ipx-muted', t('ip.reasons.empty'))); return box; }
|
||
var maxW = 1;
|
||
v.reasons.forEach(function (r) { maxW = Math.max(maxW, Math.abs(weightPts(r.weight))); });
|
||
var ul = h('ul', 'ipx-reasons');
|
||
v.reasons.forEach(function (r) {
|
||
var w = weightPts(r.weight), neg = w < 0;
|
||
var bar = h('span', 'ipx-wbar ' + (neg ? 'neg' : 'pos'), h('i'));
|
||
bar.firstChild.style.width = Math.max(4, Math.round(Math.abs(w) / maxW * 100)) + '%';
|
||
ul.appendChild(h('li', 'ipx-reason',
|
||
h('span', 'ipx-reason-t', reasonText(r)),
|
||
h('span', 'ipx-reason-m',
|
||
bar,
|
||
h('span', 'ipx-num ipx-w ' + (neg ? 'neg' : 'pos'), { title: t('ip.reasons.weight') }, (w > 0 ? '+' : '') + N(w)),
|
||
num(r.n) > 1 ? h('span', 'ipx-num ipx-x', '×' + N(num(r.n))) : null)));
|
||
});
|
||
box.appendChild(ul);
|
||
return box;
|
||
}
|
||
function actionsBlock(d) {
|
||
var box = h('div', 'ipx-block');
|
||
box.appendChild(h('h3', 'ipx-h3', t('ip.actions')));
|
||
var list = arr(d.actions).filter(isObj).map(function (a) { return pick(ACTIONS, a.code, ''); }).filter(Boolean);
|
||
var lv = levelOf(isObj(d.verdict) ? d.verdict.level : d.level);
|
||
if (!list.length && lv !== 'low' && !(isObj(d.verdict) && d.verdict.admin) && S) list.push('replay');
|
||
if (!list.length) { box.appendChild(h('p', 'ipx-muted', t('ip.actions.empty'))); return box; }
|
||
var ol = h('ol', 'ipx-actions');
|
||
list.forEach(function (code) {
|
||
var sk = 'intel.action.' + code, sv = t(sk), text = sv !== sk ? sv : t('ip.action.' + code);
|
||
var inner = h('span', 'ipx-action-t', text);
|
||
if (code === 'replay' && S) inner = h('a', 'ipx-action-t ipx-action-a', { href: replayHref(S.ip, S.ctx) }, text);
|
||
ol.appendChild(h('li', 'ipx-action tone-' + (ACTION_TONE[code] || 'neutral'), inner));
|
||
});
|
||
box.appendChild(ol);
|
||
return box;
|
||
}
|
||
|
||
function exposureBanner(d) {
|
||
var list = arr(d.exposure).filter(isObj);
|
||
if (!list.length) return null;
|
||
var open = false, LIM = 4;
|
||
var box = h('div', 'ipx-banner tone-danger', { role: 'alert' });
|
||
box.appendChild(h('div', 'ipx-banner-h', h('span', 'ipx-banner-ic', '!'), h('strong', null, t('ip.expo.title'))));
|
||
box.appendChild(h('p', 'ipx-banner-p', t('ip.expo.body')));
|
||
var rows = h('ul', 'ipx-expo');
|
||
var toggle = h('button', 'ipx-link', { type: 'button' });
|
||
function paint() {
|
||
clear(rows);
|
||
list.slice(0, open ? list.length : LIM).forEach(function (x) {
|
||
var st = num(x.status);
|
||
rows.appendChild(h('li', 'ipx-expo-r',
|
||
h('span', 'ipx-expo-path', untrusted(clip(x.path, 300))),
|
||
h('span', 'ipx-expo-meta',
|
||
badge(String(st || '2xx'), 'danger', 'ipx-num'),
|
||
has(x.bytes) ? h('span', 'ipx-num', bytes(x.bytes)) : null,
|
||
x.host ? h('span', 'ipx-mono ipx-expo-host', clip(x.host, 80)) : null,
|
||
ts(x.t) ? h('time', 'ipx-num ipx-faint', dt(ts(x.t))) : null)));
|
||
});
|
||
toggle.textContent = open ? t('ip.expo.less') : t('ip.expo.more', { n: list.length - LIM });
|
||
}
|
||
toggle.addEventListener('click', function () { open = !open; paint(); });
|
||
paint();
|
||
box.appendChild(rows);
|
||
if (list.length > LIM) box.appendChild(toggle);
|
||
return box;
|
||
}
|
||
function incidentBanner(d) {
|
||
var ssh = isObj(d.ssh) ? d.ssh : null;
|
||
if (!ssh || !ssh.ok_after_fail) return null;
|
||
var fails = num(ssh.fails);
|
||
var box = h('div', 'ipx-banner tone-danger', { role: 'alert' });
|
||
box.appendChild(h('div', 'ipx-banner-h', h('span', 'ipx-banner-ic', '!'), h('strong', null, t('ip.inc.title'))));
|
||
box.appendChild(h('p', 'ipx-banner-p', fails ? t('ip.inc.body', { n: N(fails) }) : t('ip.inc.body.nofails')));
|
||
return box;
|
||
}
|
||
|
||
function chip(labelKey, content, tone, hint) {
|
||
var c = h('div', 'ipx-chip' + (tone ? ' tone-' + tone : ''), h('span', 'ipx-chip-k', t(labelKey)), h('span', 'ipx-chip-v', content));
|
||
if (hint) c.setAttribute('title', hint);
|
||
return c;
|
||
}
|
||
function ntReason(r) {
|
||
r = str(r);
|
||
var m = /^(asn|asorg|rdns):(.*)$/.exec(r);
|
||
if (m) return t('ip.ntr.' + m[1], { v: clip(m[2], 40) });
|
||
if (r === 'tor-exit-list') return t('ip.ntr.tor');
|
||
return '';
|
||
}
|
||
function identityChips(d) {
|
||
var box = h('div', 'ipx-chips'), id = isObj(d.identity) ? d.identity : {}, geo = isObj(d.geo) ? d.geo : {};
|
||
var cc = str(has(geo.cc) ? geo.cc : d.cc).toUpperCase(), country = str(geo.country || d.country), region = str(geo.region), city = str(geo.city || d.city);
|
||
if (cc || country || city) {
|
||
var place = [city, region, country || (fmt.country && cc ? fmt.country(cc) : cc)].filter(function (x, i, a) { return x && a.indexOf(x) === i; }).join(', ');
|
||
var f = cc && fmt.flag ? fmt.flag(cc) : '';
|
||
box.appendChild(chip('ip.id.location', h('span', null, f ? h('span', 'ipx-flag', f + ' ') : null, place, geo.approx ? h('small', 'ipx-approx', ' ' + t('ip.id.approx')) : null)));
|
||
}
|
||
var asn = has(id.asn) ? id.asn : d.asn, org = str(id.as_org || d.as_org);
|
||
if (asn || org) box.appendChild(chip('ip.id.network', h('span', null, h('span', 'ipx-mono', asn ? 'AS' + num(asn) : ''), org ? ' ' + clip(org, 70) : '')));
|
||
var rdns = str(has(id.rdns) ? id.rdns : d.rdns);
|
||
var rv = h('span', null);
|
||
if (rdns) {
|
||
rv.appendChild(untrusted(clip(rdns, 120)));
|
||
if (has(id.fcrdns_ok)) rv.appendChild(h('span', 'ipx-seal ' + (id.fcrdns_ok ? 'ok' : 'bad'), { title: t('ip.id.fcrdns.hint') }, (id.fcrdns_ok ? '✓ ' : '⚠ ') + t(id.fcrdns_ok ? 'ip.id.fcrdns.ok' : 'ip.id.fcrdns.bad')));
|
||
} else rv.appendChild(h('span', 'ipx-faint', t('ip.id.rdns.none')));
|
||
box.appendChild(chip('ip.id.rdns', rv));
|
||
if (id.net_type) {
|
||
var nt = pick(NETTYPES, id.net_type, 'unknown'), why = ntReason(id.net_type_reason);
|
||
var ntw = h('span', null, badge(t('ip.nt.' + nt.replace('/', '-')), NT_TONE[nt]), why ? h('small', 'ipx-faint ipx-why', ' ' + why) : null);
|
||
if (nt === 'tor' && U.help) U.help(ntw, 'term.tor');
|
||
box.appendChild(chip('ip.id.nettype', ntw));
|
||
}
|
||
if (id.prefix) box.appendChild(chip('ip.id.prefix', h('span', 'ipx-mono', clip(id.prefix, 50))));
|
||
return box;
|
||
}
|
||
|
||
function iocText(d, v, ip, ctx) {
|
||
var id = isObj(d.identity) ? d.identity : {}, geo = isObj(d.geo) ? d.geo : {}, tm = isObj(d.time) ? d.time : {};
|
||
var first = ts(has(tm.first) ? tm.first : d.first), last = ts(has(tm.last) ? tm.last : d.last);
|
||
var lines = ['indicator: ' + (ip.indexOf(':') >= 0 ? 'ipv6-addr' : 'ipv4-addr') + ':' + ip, 'level: ' + v.level, 'score: ' + v.score + '/1000'];
|
||
if (first) lines.push('first_seen: ' + new Date(first * 1000).toISOString());
|
||
if (last) lines.push('last_seen: ' + new Date(last * 1000).toISOString());
|
||
var asn = has(id.asn) ? id.asn : d.asn;
|
||
if (asn) lines.push('asn: AS' + num(asn) + (id.as_org || d.as_org ? ' ' + clip(id.as_org || d.as_org, 80) : ''));
|
||
var cc = geo.cc || d.cc;
|
||
if (cc) lines.push('country: ' + String(cc).toUpperCase());
|
||
if (v.reasons.length) lines.push('reasons: ' + v.reasons.map(function (r) { return str(r.code); }).join(', '));
|
||
lines.push('source: Urutau');
|
||
return lines.join('\n');
|
||
}
|
||
|
||
function campHref(id, from, to) { return '#/replay?' + qs({ campaign: id, from: Math.floor(from || 0), to: Math.ceil(to || 0) }); }
|
||
function replayHref(ip, ctx, from, to) {
|
||
var q = { ip: ip };
|
||
if (from || to) { q.from = Math.floor(from); q.to = Math.ceil(to); }
|
||
else { var p = rParams(ctx); Object.keys(p).forEach(function (k) { q[k] = p[k]; }); }
|
||
return '#/replay?' + qs(q);
|
||
}
|
||
|
||
function toolbar(d, v, ip, ctx) {
|
||
var box = h('div', 'ipx-tools');
|
||
var row = h('div', 'ipx-btns');
|
||
function btn(key, fn, cls) { var b = h('button', 'ipx-btn' + (cls ? ' ' + cls : ''), { type: 'button' }, t(key)); b.addEventListener('click', fn); return b; }
|
||
row.appendChild(btn('ip.act.copy', function () { copyText(ip); }));
|
||
row.appendChild(btn('ip.act.ioc', function () { copyText(iocText(d, v, ip, ctx)); }));
|
||
row.appendChild(btn('ip.act.json', function () { download('urutau-ip-' + fileSlug(ip) + '.json', 'application/json', JSON.stringify(d, null, 2)); }));
|
||
var q = qs(rParams(ctx));
|
||
row.appendChild(h('a', 'ipx-btn', { href: '/api/v1/ip/' + encodeURIComponent(ip) + '/stix' + (q ? '?' + q : ''), download: 'urutau-ip-' + fileSlug(ip) + '.stix.json' }, t('ip.act.stix')));
|
||
row.appendChild(h('a', 'ipx-btn primary', { href: replayHref(ip, ctx) }, t('ip.act.replay')));
|
||
box.appendChild(row);
|
||
var ext = h('div', 'ipx-ext');
|
||
ext.appendChild(h('span', 'ipx-ext-t', t('ip.ext.title')));
|
||
var ul = h('ul', 'ext-links ipx-extl');
|
||
extLinks(ip).forEach(function (l) {
|
||
ul.appendChild(h('li', null, h('a', 'ipx-extlink', { href: l[1], target: '_blank', rel: 'noopener noreferrer', 'aria-label': t('ip.ext.' + l[0]) + ' ' + t('ip.ext.out') }, t('ip.ext.' + l[0]), icoExit())));
|
||
});
|
||
ext.appendChild(ul);
|
||
ext.appendChild(h('span', 'ipx-faint ipx-ext-n', t('ip.ext.note')));
|
||
box.appendChild(ext);
|
||
return box;
|
||
}
|
||
|
||
function verdictCard(d, ip, ctx) {
|
||
var v = normalizeVerdict(d);
|
||
var tone = v.admin ? 'info' : LEVEL_TONE[v.level];
|
||
var node = h('section', 'ipx-card ipx-s12 ip-verdict tone-' + tone);
|
||
node.setAttribute('aria-label', t('ip.sec.verdict'));
|
||
var top = h('div', 'ipx-vtop');
|
||
var title = h('div', 'ipx-vtitle',
|
||
h('div', 'ipx-ipline', h('h2', 'ipx-ip ipx-mono', ip),
|
||
badge(v.admin ? t('ip.admin') : t('ip.level.' + v.level), tone),
|
||
isBanned(d) ? badge(t('ip.def.active'), 'warn') : null),
|
||
h('p', 'ipx-lead', leadText(d, v, ctx)));
|
||
var sc = h('div', 'ipx-score', { role: 'img', 'aria-label': t('ip.score.label', { n: v.score }) },
|
||
h('div', 'ipx-score-n', h('span', 'ipx-num ipx-score-v', N(v.score)), h('span', 'ipx-score-of', t('ip.score.of'))),
|
||
(function () {
|
||
var b = h('div', 'ipx-sbar', h('i'), h('b', 'ipx-cut', { title: t('ip.score.cuts', { a: 10, b: 50 }) }), h('b', 'ipx-cut hi', { title: t('ip.score.cuts', { a: 10, b: 50 }) }));
|
||
b.firstChild.style.width = Math.max(v.score ? 2 : 0, v.score / 10) + '%';
|
||
b.children[1].style.left = '1%'; b.children[2].style.left = '5%';
|
||
return b;
|
||
})(),
|
||
h('div', 'ipx-score-cuts ipx-faint', t('ip.score.cuts', { a: 10, b: 50 })),
|
||
v.level === 'hostile' && v.strong && !v.admin && v.reasons.length ? h('div', 'ipx-score-rule', h('strong', null, t('ip.score.rule.k') + ' '), reasonText(v.reasons[0])) : null,
|
||
h('div', 'ipx-score-conf', h('span', 'ipx-faint', t('ip.confidence') + ': '), v.admin ? t('ip.confidence.admin') : v.strong ? t('ip.confidence.high') : t('ip.confidence.medium')));
|
||
top.appendChild(title);
|
||
top.appendChild(sc);
|
||
node.appendChild(top);
|
||
var b1 = exposureBanner(d), b2 = incidentBanner(d);
|
||
if (b1 || b2) { var bs = h('div', 'ipx-banners'); if (b1) bs.appendChild(b1); if (b2) bs.appendChild(b2); node.appendChild(bs); }
|
||
var two = h('div', 'ipx-vtwo');
|
||
if (has(d.verdict) || has(d.actions)) {
|
||
two.appendChild(reasonsBlock(v));
|
||
two.appendChild(actionsBlock(d));
|
||
node.appendChild(two);
|
||
}
|
||
node.appendChild(identityChips(d));
|
||
node.appendChild(toolbar(d, v, ip, ctx));
|
||
return node;
|
||
}
|
||
|
||
|
||
// ---------------------------------------------------------------- hero: the 5-second answer
|
||
function moved(card) { var b = card && card.querySelector('.ipx-cb'); return b ? Array.prototype.slice.call(b.childNodes) : []; }
|
||
function hostBans(d) {
|
||
var by = {}, order = [];
|
||
banList(d).forEach(function (b) {
|
||
var k = b.host || '';
|
||
if (!by[k]) { by[k] = { host: k, jails: [], active: false, last: 0 }; order.push(k); }
|
||
var g = by[k];
|
||
if (b.active) { g.active = true; if (b.jail && g.jails.indexOf(b.jail) < 0) g.jails.push(b.jail); }
|
||
if (b.t > g.last) g.last = b.t;
|
||
});
|
||
arr(d.hosts).forEach(function (x) { var k = keyOf(x); if (k && !by[k]) { by[k] = { host: k, jails: [], active: false, last: 0 }; order.push(k); } });
|
||
return order.map(function (k) { return by[k]; });
|
||
}
|
||
function moreList(list, n) {
|
||
var out = list.slice(0, n).join(', ');
|
||
return list.length > n ? out + ' ' + t('ip.q.more', { n: N(list.length - n) }) : out;
|
||
}
|
||
function qCell(key, main, sub, tone) {
|
||
return h('div', 'ipx-q' + (tone ? ' tone-' + tone : ''), h('dt', 'ipx-q-k', t(key)), h('dd', 'ipx-q-v', main, sub ? h('span', 'ipx-q-s', sub) : null));
|
||
}
|
||
function heroCard(d, ip, ctx) {
|
||
var v = normalizeVerdict(d), tone = v.admin ? 'info' : LEVEL_TONE[v.level];
|
||
var node = h('header', 'ipx-hero tone-' + tone);
|
||
var id = isObj(d.identity) ? d.identity : {}, geo = isObj(d.geo) ? d.geo : {};
|
||
var cc = str(geo.cc || d.cc).toUpperCase(), asn = has(id.asn) ? id.asn : d.asn, org = str(id.as_org || d.as_org), rdns = str(has(id.rdns) ? id.rdns : d.rdns);
|
||
var place = [str(geo.city || d.city), str(geo.country || d.country) || (fmt.country && cc ? fmt.country(cc) : cc)].filter(Boolean).join(', ');
|
||
var idl = h('p', 'ipx-hero-id');
|
||
if (place) idl.appendChild(h('span', 'ipx-hero-i', cc && fmt.flag ? fmt.flag(cc) + ' ' : '', place));
|
||
if (asn || org) idl.appendChild(h('span', 'ipx-hero-i', h('span', 'ipx-mono', asn ? 'AS' + num(asn) : ''), org ? ' ' + clip(org, 60) : ''));
|
||
if (rdns) {
|
||
var rd = h('span', 'ipx-hero-i ipx-hero-rdns', untrusted(clip(rdns, 120)));
|
||
if (has(id.fcrdns_ok)) rd.appendChild(h('span', 'ipx-seal ' + (id.fcrdns_ok ? 'ok' : 'bad'), { title: t('ip.id.fcrdns.hint') }, (id.fcrdns_ok ? '✓ ' : '⚠ ') + t(id.fcrdns_ok ? 'ip.id.fcrdns.ok' : 'ip.id.fcrdns.bad')));
|
||
idl.appendChild(rd);
|
||
}
|
||
var over = v.raw > 1000;
|
||
var score = h('div', 'ipx-hero-score', { role: 'img', 'aria-label': t('ip.score.label', { n: v.score }) + (over ? '. ' + t('ip.score.over', { n: N(Math.round(v.raw)) }) : ''), title: over ? t('ip.score.over', { n: N(Math.round(v.raw)) }) : '' },
|
||
h('span', 'ipx-num ipx-hero-sv', N(v.score) + (over ? '+' : '')), h('span', 'ipx-hero-so', t('ip.score.of')));
|
||
node.appendChild(h('div', 'ipx-hero-top',
|
||
h('div', 'ipx-hero-main',
|
||
h('div', 'ipx-hero-line', h('h1', 'ipx-hero-ip ipv', ip), badge(v.admin ? t('ip.admin') : t('ip.level.' + v.level), tone, 'ipx-hero-lv')),
|
||
h('p', 'ipx-hero-lead', leadText(d, v, ctx)),
|
||
idl.firstChild ? idl : null),
|
||
score));
|
||
// the four questions
|
||
var q = h('dl', 'ipx-qs');
|
||
var cats = entries(d.counts).filter(function (e) { return e[0] !== 'ban' && e[1] > 0; });
|
||
var fams = arr(d.families).filter(isObj).sort(function (a, b) { return num(b.n) - num(a.n); });
|
||
q.appendChild(cats.length
|
||
? qCell('ip.q.what', cats.slice(0, 2).map(function (e) { return catLabel(e[0]) + ' (' + N(e[1]) + ')'; }).join(', '), fams.length ? moreList(fams.map(function (f) { return famLabel(f.fam); }), 2) : '')
|
||
: qCell('ip.q.what', h('span', 'ipx-faint', t('ip.q.nothing'))));
|
||
var tm = isObj(d.time) ? d.time : {}, first = ts(has(tm.first) ? tm.first : d.first), last = ts(has(tm.last) ? tm.last : d.last);
|
||
q.appendChild(qCell('ip.q.when', first ? dShort(first) + (last && last !== first ? ' → ' + dShort(last) : '') : '-', last ? t('ip.q.last', { ago: ago(last) }) : ''));
|
||
var doms = [];
|
||
arr(d.targets).forEach(function (x) { if (isObj(x) && x.domain && doms.indexOf(x.domain) < 0) doms.push(str(x.domain)); });
|
||
if (!doms.length) arr(d.domains).forEach(function (x) { var k = keyOf(x); if (k) doms.push(k); });
|
||
var hostsL = arr(d.hosts).map(keyOf).filter(Boolean);
|
||
q.appendChild(qCell('ip.q.against', doms.length ? h('span', 'ipx-q-wrap', moreList(doms.map(function (x) { return clip(x, 60).replace(/\./g, '.\u200b'); }), 2)) : hostsL.length ? moreList(hostsL, 3) : '-', doms.length && hostsL.length ? 'host: ' + moreList(hostsL, 3) : ''));
|
||
var hb = hostBans(d).filter(function (g) { return g.active; }), bl = isObj(d.blocklist) ? !!d.blocklist.listed : !!d.blocklisted;
|
||
var bv = h('span', 'ipx-q-block', hb.length ? t('ip.q.blocked.yes', { hosts: hb.map(function (g) { return g.host || '?'; }).join(', ') }) : isBanned(d) ? t('ip.def.active') : t('ip.q.blocked.no'));
|
||
var bcell = qCell('ip.q.blocked', bv, bl ? t('ip.q.blocked.list') : '', hb.length || isBanned(d) ? 'ok' : (v.level === 'hostile' ? 'danger' : ''));
|
||
if (isBanned(d) && U.unbanDialog) bcell.lastChild.appendChild(h('button', 'ipx-btn sm ipx-q-act', { type: 'button', onclick: function () { U.unbanDialog(d.ip || ip, function () { if (S) load(S); }); } }, t('unban.btn')));
|
||
q.appendChild(bcell);
|
||
node.appendChild(q);
|
||
var b1 = exposureBanner(d), b2 = incidentBanner(d);
|
||
if (b1) node.appendChild(b1);
|
||
if (b2) node.appendChild(b2);
|
||
return node;
|
||
}
|
||
function summaryCard(d, ip, ctx) {
|
||
var v = normalizeVerdict(d);
|
||
var c = card('ip.sec.summary', null, 12, 'ipx-summary');
|
||
var two = h('div', 'ipx-vtwo');
|
||
two.appendChild(reasonsBlock(v));
|
||
two.appendChild(actionsBlock(d));
|
||
var conf = h('p', 'ipx-faint ipx-conf', t('ip.score.cuts', { a: 10, b: 50 }) + ' ' + t('ip.confidence') + ': ' + (v.admin ? t('ip.confidence.admin') : v.strong ? t('ip.confidence.high') : t('ip.confidence.medium')) + '.');
|
||
c.body.appendChild(two);
|
||
c.body.appendChild(conf);
|
||
c.body.appendChild(toolbar(d, v, ip, ctx));
|
||
return c.node;
|
||
}
|
||
function attackCard(d) {
|
||
var tg = safe(function () { return targetsCard(d); }), te = safe(function () { return techniquesCard(d); });
|
||
if (!tg && !te) return null;
|
||
var c = card('ip.sec.attack', 'ip.attack.hint', 12);
|
||
var g = h('div', 'ipx-attack');
|
||
if (tg) g.appendChild(h('div', 'ipx-attack-t', moved(tg)));
|
||
if (te) g.appendChild(h('div', 'ipx-attack-m', moved(te)));
|
||
c.body.appendChild(g);
|
||
return c.node;
|
||
}
|
||
function identityCard(d) {
|
||
var c = card('ip.id.title', 'ip.id.hint', 12);
|
||
c.body.appendChild(identityChips(d));
|
||
var cl = safe(function () { return clientsCard(d); });
|
||
if (cl) c.body.appendChild(h('div', 'ipx-idcl', moved(cl)));
|
||
return c.node;
|
||
}
|
||
|
||
// ---------------------------------------------------------------- B: activity
|
||
function weekdayName(i) {
|
||
try { return new Date(Date.UTC(2024, 0, 1 + i)).toLocaleDateString(lang(), { weekday: 'short', timeZone: 'UTC' }); } catch (e) { return String(i + 1); }
|
||
}
|
||
function timelineData(d) {
|
||
var tl = isObj(d.timeline) ? d.timeline : null;
|
||
if (!tl || !isObj(tl.series)) return null;
|
||
var step = num(tl.step) || 3600, start = ts(tl.start), n = 0;
|
||
Object.keys(tl.series).forEach(function (k) { n = Math.max(n, arr(tl.series[k]).length); });
|
||
if (!n || !start) return null;
|
||
var cats = STACK.filter(function (c) { return arr(tl.series[c]).some(function (x) { return num(x) > 0; }); });
|
||
var tot = [], i;
|
||
for (i = 0; i < n; i++) {
|
||
var s = 0;
|
||
STACK.forEach(function (c) { s += num(arr(tl.series[c])[i]); });
|
||
tot.push(s);
|
||
}
|
||
return { start: start, step: step, n: n, series: tl.series, cats: cats, total: tot };
|
||
}
|
||
|
||
function timelineBlock(d, tl) {
|
||
var box = h('div', 'ipx-block');
|
||
box.appendChild(sub('ip.tl.title', 'ip.tl.hint'));
|
||
if (estNote(d, 'timeline')) box.appendChild(estNote(d, 'timeline'));
|
||
if (!tl || !tl.cats.length) { box.appendChild(emptyState(t('ip.tl.empty'))); return box; }
|
||
var n = tl.n, max = 1, peak = 0, i;
|
||
for (i = 0; i < n; i++) if (tl.total[i] > max) { max = tl.total[i]; peak = i; }
|
||
var H = 100, wrap = h('div', 'ipx-chart');
|
||
var g = svg('svg', { viewBox: '0 0 ' + n + ' ' + H, preserveAspectRatio: 'none', class: 'ipx-svg', role: 'img', 'aria-label': t('ip.tl.title') + '. ' + t('ip.tl.peak', { n: N(max), when: dShort(tl.start + peak * tl.step) }) });
|
||
for (i = 0; i <= 3; i++) g.appendChild(svg('line', { x1: 0, x2: n, y1: H - i * H / 3, y2: H - i * H / 3, class: 'ipx-grid-l', 'vector-effect': 'non-scaling-stroke' }));
|
||
for (i = 0; i < n; i++) {
|
||
var y = H;
|
||
tl.cats.forEach(function (c) {
|
||
var v = num(arr(tl.series[c])[i]);
|
||
if (v <= 0) return;
|
||
var hh = v / max * (H - 4);
|
||
y -= hh;
|
||
g.appendChild(svg('rect', { x: i + 0.08, y: y, width: 0.84, height: hh, class: 'ipx-c-' + c }));
|
||
});
|
||
var parts = tl.cats.map(function (c) { var v = num(arr(tl.series[c])[i]); return v ? catLabel(c) + ' ' + N(v) : ''; }).filter(Boolean).join(', ');
|
||
g.appendChild(svg('rect', { x: i, y: 0, width: 1, height: H, class: 'ipx-hit' }, svg('title', {}, t('ip.tl.tip', { when: dShort(tl.start + i * tl.step), n: tl.total[i] ? N(tl.total[i]) + ' (' + parts + ')' : '0' }))));
|
||
}
|
||
arr(has(d.bans) ? d.bans : d.ban_history).forEach(function (b) {
|
||
if (!isObj(b)) return;
|
||
[[ts(b.t), 'ban'], [ts(b.unban), 'unban']].forEach(function (p) {
|
||
if (!p[0]) return;
|
||
var x = (p[0] - tl.start) / tl.step;
|
||
if (x < 0 || x > n) return;
|
||
g.appendChild(svg('line', { x1: x, x2: x, y1: 0, y2: H, class: 'ipx-mark ' + p[1], 'vector-effect': 'non-scaling-stroke' }, svg('title', {}, t('ip.tl.' + p[1]) + ' ' + (b.jail ? clip(b.jail, 30) + ' ' : '') + dShort(p[0]))));
|
||
});
|
||
});
|
||
wrap.appendChild(g);
|
||
box.appendChild(wrap);
|
||
var axis = h('div', 'ipx-axis');
|
||
for (i = 0; i < 5; i++) axis.appendChild(h('span', 'ipx-num', dShort(tl.start + Math.min(n, Math.round(n * i / 4)) * tl.step)));
|
||
box.appendChild(axis);
|
||
var leg = h('ul', 'ipx-legend');
|
||
tl.cats.forEach(function (c) {
|
||
var tot = 0; arr(tl.series[c]).forEach(function (x) { tot += num(x); });
|
||
leg.appendChild(h('li', null, h('span', 'ipx-sw ipx-bg-' + c), h('span', null, catLabel(c)), h('span', 'ipx-num ipx-faint', N(tot))));
|
||
});
|
||
if (arr(has(d.bans) ? d.bans : d.ban_history).length) leg.appendChild(h('li', null, h('span', 'ipx-sw-mark'), h('span', null, t('ip.tl.ban'))));
|
||
box.appendChild(leg);
|
||
box.appendChild(h('p', 'ipx-faint ipx-peak', t('ip.tl.peak', { n: N(max), when: dShort(tl.start + peak * tl.step) })));
|
||
return box;
|
||
}
|
||
|
||
function heatmapBlock(tl) {
|
||
var box = h('div', 'ipx-block');
|
||
if (!tl || activeDays(tl) < 2) return null;
|
||
box.appendChild(sub('ip.hm.title', 'ip.hm.hint'));
|
||
if (!tl) { box.appendChild(emptyState(t('ip.hm.empty'))); return box; }
|
||
var grid = [], r, c, max = 0, any = 0;
|
||
for (r = 0; r < 7; r++) { grid.push([]); for (c = 0; c < 24; c++) grid[r].push(0); }
|
||
for (var i = 0; i < tl.n; i++) {
|
||
var dte = new Date((tl.start + i * tl.step) * 1000), wd = (dte.getUTCDay() + 6) % 7, hr = dte.getUTCHours();
|
||
grid[wd][hr] += tl.total[i]; any += tl.total[i];
|
||
}
|
||
for (r = 0; r < 7; r++) for (c = 0; c < 24; c++) if (grid[r][c] > max) max = grid[r][c];
|
||
if (!any) { box.appendChild(emptyState(t('ip.hm.empty'))); return box; }
|
||
var hm = h('div', 'ipx-hm', { role: 'img', 'aria-label': t('ip.hm.title') });
|
||
var head = h('div', 'ipx-hm-row ipx-hm-head', h('span', 'ipx-hm-l'));
|
||
for (c = 0; c < 24; c++) head.appendChild(h('span', 'ipx-hm-h ipx-num', c % 6 === 0 ? String(c) : ''));
|
||
hm.appendChild(head);
|
||
for (r = 0; r < 7; r++) {
|
||
var row = h('div', 'ipx-hm-row', h('span', 'ipx-hm-l', weekdayName(r)));
|
||
for (c = 0; c < 24; c++) {
|
||
var v = grid[r][c], lvl = v ? Math.min(5, 1 + Math.floor(4.999 * Math.sqrt(v / max))) : 0;
|
||
row.appendChild(h('span', 'ipx-hm-c l' + lvl, { title: t('ip.hm.tip', { day: weekdayName(r), hour: c, n: N(v) }) }));
|
||
}
|
||
hm.appendChild(row);
|
||
}
|
||
box.appendChild(hm);
|
||
var leg = h('div', 'ipx-hm-leg', h('span', 'ipx-faint', t('ip.hm.less')));
|
||
for (var l = 1; l <= 5; l++) leg.appendChild(h('span', 'ipx-hm-c l' + l));
|
||
leg.appendChild(h('span', 'ipx-faint', t('ip.hm.more') + ' (max ' + N(max) + ')'));
|
||
box.appendChild(leg);
|
||
return box;
|
||
}
|
||
|
||
function factRow(k, v) { return h('div', 'ipx-fact', h('dt', null, k), h('dd', null, v)); }
|
||
function activeDays(tl) {
|
||
var days = {};
|
||
for (var i = 0; i < tl.n; i++) if (tl.total[i] > 0) days[Math.floor((tl.start + i * tl.step) / 86400)] = 1;
|
||
return Object.keys(days).length;
|
||
}
|
||
function timeBlock(d) {
|
||
var tm = isObj(d.time) ? d.time : null;
|
||
var first = ts(tm ? tm.first : d.first), last = ts(tm ? tm.last : d.last);
|
||
if (!tm && !first && !last) return null;
|
||
var box = h('div', 'ipx-block');
|
||
box.appendChild(h('h3', 'ipx-h3', t('ip.time.title')));
|
||
var dl = h('dl', 'ipx-facts');
|
||
if (first) dl.appendChild(factRow(t('ip.time.first'), h('span', null, h('span', 'ipx-num', dt(first)), h('small', 'ipx-faint', ' ' + ago(first)))));
|
||
if (last) dl.appendChild(factRow(t('ip.time.last'), h('span', null, h('span', 'ipx-num', dt(last)), h('small', 'ipx-faint', ' ' + ago(last)))));
|
||
var tl0 = timelineData(d), ad = tm && has(tm.active_days) ? num(tm.active_days) : 0;
|
||
if (!ad && tl0) ad = activeDays(tl0);
|
||
if (ad) dl.appendChild(factRow(t('ip.time.active'), h('span', 'ipx-num', pl('ip.n.days', ad))));
|
||
var sn = Math.max(arr(d.sessions).length, tm ? num(tm.sessions_n) : 0);
|
||
if (sn) dl.appendChild(factRow(t('ip.time.sessions'), h('span', 'ipx-num', pl('ip.n.sessions', sn))));
|
||
if (tm && has(tm.returning)) dl.appendChild(factRow(t('ip.time.returning'), tm.returning ? badge(t('ip.time.returning.yes'), 'warn') : h('span', null, t('ip.time.returning.no'))));
|
||
box.appendChild(dl);
|
||
return box;
|
||
}
|
||
function cadenceBlock(d) {
|
||
var c = isObj(d.cadence) ? d.cadence : null;
|
||
if (!c) return null;
|
||
var box = h('div', 'ipx-block');
|
||
var verdict = pick(CADENCE, c.verdict, 'insufficient');
|
||
box.appendChild(h('div', 'ipx-subline', h('h3', 'ipx-h3', t('ip.cad.title')), badge(t('ip.cad.' + verdict), CAD_TONE[verdict])));
|
||
box.appendChild(h('p', 'ipx-muted', t('ip.cad.' + verdict + '.why', { n: N(num(c.n)) })));
|
||
if (verdict !== 'insufficient') {
|
||
var burst = has(c.burst_max_60s) ? c.burst_max_60s : c.burst_max_60;
|
||
var dl = h('dl', 'ipx-facts ipx-facts-2');
|
||
dl.appendChild(factRow(t('ip.cad.median'), h('span', 'ipx-num', dur(c.median_s))));
|
||
dl.appendChild(factRow(t('ip.cad.spread'), h('span', 'ipx-num', dur(c.p10_s) + ' – ' + dur(c.p90_s))));
|
||
var cv = factRow(t('ip.cad.cv'), h('span', 'ipx-num', (Math.round(num(c.cv) * 100) / 100).toLocaleString(lang())));
|
||
cv.setAttribute('title', t('ip.cad.cv.hint'));
|
||
dl.appendChild(cv);
|
||
dl.appendChild(factRow(t('ip.cad.burst'), h('span', 'ipx-num', N(num(burst)) + ' ', h('small', 'ipx-faint', t('ip.cad.burst.unit')))));
|
||
dl.appendChild(factRow(t('ip.cad.n'), h('span', 'ipx-num', N(num(c.n)))));
|
||
box.appendChild(dl);
|
||
}
|
||
return box;
|
||
}
|
||
|
||
function activityCard(d) {
|
||
var tl = timelineData(d), tb = timeBlock(d), cb = cadenceBlock(d);
|
||
if (!tl && !tb && !cb) return null;
|
||
var c = card('ip.sec.activity', null, 8);
|
||
c.body.appendChild(timelineBlock(d, tl));
|
||
var hm = heatmapBlock(tl);
|
||
if (hm) c.body.appendChild(hm);
|
||
if (tb || cb) {
|
||
var row = h('div', 'ipx-pair');
|
||
if (tb) row.appendChild(tb);
|
||
if (cb) row.appendChild(cb);
|
||
c.body.appendChild(row);
|
||
}
|
||
return c.node;
|
||
}
|
||
|
||
function defenseCard(d) {
|
||
var list = banList(d), ttb = d.ttb_s, bl = isObj(d.blocklist) ? d.blocklist : (has(d.blocklisted) ? { listed: !!d.blocklisted } : null);
|
||
var banned = isBanned(d);
|
||
if (!(num(ttb) > 0)) {
|
||
var tm0 = isObj(d.time) ? d.time : {}, f0 = ts(has(tm0.first) ? tm0.first : d.first), bt = 0;
|
||
list.forEach(function (x) { if (x.t && (!bt || x.t < bt)) bt = x.t; });
|
||
if (f0 && bt >= f0) ttb = bt - f0;
|
||
}
|
||
if (!list.length && !has(ttb) && !bl && !banned) return null;
|
||
var c = card('ip.def.title', null, 12);
|
||
var b = h('div', 'ipx-defgrid');
|
||
var hs = h('div', 'ipx-block');
|
||
hs.appendChild(h('h3', 'ipx-h3', t('ip.def.hosts')));
|
||
var groups = hostBans(d);
|
||
if (!groups.length) hs.appendChild(h('p', 'ipx-muted', banned ? t('ip.def.active') : t('ip.def.bans.empty')));
|
||
else {
|
||
var ul = h('ul', 'ipx-hostst');
|
||
groups.forEach(function (g) {
|
||
ul.appendChild(h('li', 'ipx-hst' + (g.active ? ' on' : ''),
|
||
h('span', 'ipx-dot tone-' + (g.active ? 'ok' : 'neutral'), { 'aria-hidden': 'true' }),
|
||
h('span', 'ipx-hst-h ipx-mono', clip(g.host, 40) || '-'),
|
||
h('span', 'ipx-hst-s', g.active ? t('ip.def.host.on', { jails: g.jails.join(', ') || '-' }) : t('ip.def.host.off'))));
|
||
});
|
||
hs.appendChild(ul);
|
||
}
|
||
if (banned && U.unbanDialog) hs.appendChild(h('button', 'ipx-btn ipx-unban', { type: 'button', onclick: function () { U.unbanDialog(d.ip, function () { if (S) load(S); }); } }, t('unban.btn')));
|
||
b.appendChild(hs);
|
||
var hist = list.filter(function (x) { return !x.synthetic; }).sort(function (x, y) { return y.t - x.t; });
|
||
var hb = h('div', 'ipx-block');
|
||
if (!hist.length) { hb.appendChild(h('h3', 'ipx-h3', t('ip.def.bans'))); hb.appendChild(h('p', 'ipx-muted', t('ip.def.bans.empty'))); }
|
||
else {
|
||
var det = h('details', 'ipx-hist');
|
||
if (hist.length <= 4) det.setAttribute('open', '');
|
||
det.appendChild(h('summary', 'ipx-h3 ipx-sum', t('ip.def.history', { n: N(hist.length) })));
|
||
var tb = h('tbody');
|
||
hist.forEach(function (x) {
|
||
tb.appendChild(h('tr', null,
|
||
h('td', 'nw', { 'data-label': t('ip.ev.time') }, h('time', 'ipx-num', x.t ? dt(x.t) : '-')),
|
||
h('td', null, { 'data-label': 'host' }, h('span', 'ipx-mono', clip(x.host, 40) || '-')),
|
||
h('td', null, { 'data-label': 'jail' }, h('span', 'ipx-mono', clip(x.jail, 40) || '-')),
|
||
h('td', null, { 'data-label': '' }, x.active ? badge(t('ip.def.active'), 'warn') : x.unban ? h('span', 'ipx-faint', t('ip.def.lifted', { when: dt(x.unban) })) : h('span', 'ipx-faint', '-'))));
|
||
});
|
||
det.appendChild(h('div', 'ipx-tbl-w', h('table', 'ipx-tbl ipx-ctbl', h('thead', null, h('tr', null, h('th', null, t('ip.ev.time')), h('th', null, 'host'), h('th', null, 'jail'), h('th', null, h('span', 'sr-only', t('ip.def.title'))))), tb)));
|
||
hb.appendChild(det);
|
||
}
|
||
b.appendChild(hb);
|
||
c.body.appendChild(b);
|
||
var f = h('dl', 'ipx-facts');
|
||
if (has(ttb) || list.length) {
|
||
var tv = has(ttb) && num(ttb) > 0 ? h('span', 'ipx-num ipx-big', dur(ttb)) : h('span', 'ipx-faint', banned ? t('ip.def.noinfo') : t('ip.def.ttb.none'));
|
||
var r = factRow(t('ip.def.ttb'), tv);
|
||
r.setAttribute('title', t('ip.def.ttb.hint'));
|
||
f.appendChild(r);
|
||
}
|
||
if (bl) f.appendChild(factRow(t('ip.def.blocklist'), bl.listed ? badge(ts(bl.since) ? t('ip.def.blocklist.yes', { when: dt(ts(bl.since)) }) : t('ip.def.blocklist.yes.nosince'), 'warn') : h('span', 'ipx-muted', t('ip.def.blocklist.no'))));
|
||
if (f.firstChild) c.body.appendChild(f);
|
||
return c.node;
|
||
}
|
||
|
||
// ---------------------------------------------------------------- C: techniques and families
|
||
function statusBar(st, sensitive) {
|
||
var parts = [['2xx', 'c2'], ['3xx', 'c3'], ['4xx', 'c4'], ['5xx', 'c5']], total = 0;
|
||
parts.forEach(function (p) { total += num(st[p[0]]); });
|
||
var bar = h('div', 'ipx-sbar2 ' + (sensitive ? 'sens' : ''), { role: 'img', 'aria-label': parts.map(function (p) { return p[0] + ' ' + N(num(st[p[0]])); }).join(', ') });
|
||
parts.forEach(function (p) {
|
||
var v = num(st[p[0]]);
|
||
if (!v || !total) return;
|
||
var i = h('i', p[1]); i.style.flexGrow = String(v); bar.appendChild(i);
|
||
});
|
||
var leg = h('div', 'ipx-st-leg');
|
||
parts.forEach(function (p) {
|
||
var v = num(st[p[0]]);
|
||
leg.appendChild(h('span', 'ipx-num ipx-st ' + p[1] + (v ? '' : ' zero') + (p[0] === '2xx' && v && sensitive ? ' hot' : ''), p[0] + ' ' + N(v)));
|
||
});
|
||
return h('div', 'ipx-stwrap', bar, leg);
|
||
}
|
||
function techniquesGrid(list) {
|
||
var grid = h('ul', 'ipx-mitres');
|
||
list.forEach(function (x) {
|
||
var id = str(x.id), url = mitreURL(id);
|
||
var inner = [
|
||
h('span', 'ipx-mitre-id ipx-mono', clip(id, 14)),
|
||
h('span', 'ipx-mitre-n', clip(x.name, 80) || id),
|
||
h('span', 'ipx-mitre-m ipx-num', pl('ip.tech.count', num(x.n)) + (ts(x.first) ? ' · ' + t('ip.tech.span', { a: dShort(ts(x.first)), b: dShort(ts(x.last) || ts(x.first)) }) : ''))
|
||
];
|
||
var a = url
|
||
? h.apply(null, ['a', 'chip-mitre ipx-mitre', { href: url, target: '_blank', rel: 'noopener noreferrer', title: t('ip.tech.open', { id: id }) }].concat(inner, [icoExit()]))
|
||
: h.apply(null, ['span', 'chip-mitre ipx-mitre'].concat(inner));
|
||
grid.appendChild(h('li', null, a));
|
||
});
|
||
return grid;
|
||
}
|
||
function familiesList(list) {
|
||
var wrap = h('div', 'tbl-group ipx-fams');
|
||
var total = 0;
|
||
list.forEach(function (f) { total += num(f.n); });
|
||
list.forEach(function (f) {
|
||
var fam = str(f.fam), sens = SENSITIVE.indexOf(fam) >= 0, st = isObj(f.status) ? f.status : {};
|
||
var hot = sens && num(st['2xx']) > 0;
|
||
var ex = arr(f.examples).filter(function (x) { return typeof x === 'string'; });
|
||
var blk = h('article', 'ipx-fam' + (hot ? ' hot' : ''));
|
||
blk.appendChild(h('div', 'ipx-fam-h',
|
||
h('h4', 'ipx-fam-n', famLabel(fam)),
|
||
hot ? badge(t('ip.fam.sensitive'), 'danger') : null,
|
||
h('span', 'ipx-num ipx-fam-c', pl('ip.fam.events', num(f.n)) + (total ? ' · ' + (fmt.pct ? fmt.pct(num(f.n), total) : '') : ''))));
|
||
blk.appendChild(statusBar(st, sens));
|
||
if (ex.length) {
|
||
var open = false, LIM = 3, ul = h('ul', 'ipx-ex'), tg = h('button', 'ipx-link', { type: 'button' });
|
||
var paint = function () {
|
||
clear(ul);
|
||
ex.slice(0, open ? ex.length : LIM).forEach(function (p) { ul.appendChild(h('li', null, untrusted(clip(p, 240)))); });
|
||
tg.textContent = open ? t('ip.fam.less') : t('ip.fam.more', { n: ex.length - LIM });
|
||
};
|
||
tg.addEventListener('click', function () { open = !open; paint(); });
|
||
paint();
|
||
blk.appendChild(h('div', 'ipx-ex-l ipx-faint', t('ip.fam.examples')));
|
||
blk.appendChild(ul);
|
||
if (ex.length > LIM) blk.appendChild(tg);
|
||
}
|
||
wrap.appendChild(blk);
|
||
});
|
||
return wrap;
|
||
}
|
||
function techniquesCard(d) {
|
||
if (!has(d.techniques) && !has(d.families)) return null;
|
||
var c = card('ip.tech.title', 'ip.tech.hint', 12);
|
||
var techs = arr(d.techniques).filter(isObj).sort(function (a, b) { return num(b.n) - num(a.n); });
|
||
var b1 = h('div', 'ipx-block');
|
||
b1.appendChild(h('h3', 'ipx-h3', t('ip.tech.mitre')));
|
||
b1.appendChild(techs.length ? techniquesGrid(techs) : h('p', 'ipx-muted', totalEvents(d) ? nologText(d) : t('ip.tech.empty')));
|
||
if (estNote(d, 'techniques')) b1.appendChild(estNote(d, 'techniques'));
|
||
c.body.appendChild(b1);
|
||
var fams = arr(d.families).filter(isObj).sort(function (a, b) { return num(b.n) - num(a.n); });
|
||
var b2 = h('div', 'ipx-block');
|
||
b2.appendChild(h('h3', 'ipx-h3', t('ip.fam.title')));
|
||
b2.appendChild(fams.length ? familiesList(fams) : h('p', 'ipx-muted', totalEvents(d) ? nologText(d) : t('ip.fam.empty')));
|
||
if (estNote(d, 'families')) b2.appendChild(estNote(d, 'families'));
|
||
c.body.appendChild(b2);
|
||
return c.node;
|
||
}
|
||
|
||
// ---------------------------------------------------------------- D: sessions and raw events
|
||
function stageTrail(stage) {
|
||
var st = pick(STAGES, stage, ''), rank = STAGES.indexOf(st);
|
||
var ol = h('ol', 'ipx-trail', { 'aria-label': st ? t('ip.stage.label', { stage: t('ip.stage.' + st) }) : t('ip.ses.stage') });
|
||
STAGES.forEach(function (s, i) {
|
||
var cls = i < rank ? 'done' : i === rank ? 'cur' : 'todo';
|
||
ol.appendChild(h('li', 'ipx-step ' + cls + ' st-' + s, h('span', 'ipx-step-d'), h('span', 'ipx-step-l', t('ip.stage.' + s))));
|
||
});
|
||
return ol;
|
||
}
|
||
function chipList(items, mapFn) {
|
||
var box = h('span', 'ipx-tags');
|
||
items.forEach(function (it) { box.appendChild(mapFn(it)); });
|
||
return box;
|
||
}
|
||
function sessionCard(s, ip) {
|
||
var start = ts(s.start), end = ts(s.end) || start;
|
||
var node = h('article', 'session-card ipx-ses' + (s.success ? ' win' : ''));
|
||
node.appendChild(h('div', 'ipx-ses-h',
|
||
h('div', 'ipx-ses-t', h('time', 'ipx-num ipx-ses-d', dt(start)), h('span', 'ipx-faint ipx-num', ago(start))),
|
||
h('div', 'ipx-ses-k', h('span', 'ipx-num', dur(has(s.dur_s) ? s.dur_s : end - start)), h('span', 'ipx-faint', '·'), h('span', 'ipx-num', pl('ip.n.events', num(s.n)))),
|
||
s.success ? badge(t('ip.ses.success'), 'danger') : null));
|
||
node.appendChild(stageTrail(s.stage));
|
||
var ba = ts(s.banned_at);
|
||
if (ba) node.appendChild(h('p', 'ipx-faint ipx-ses-b', t('ip.ses.bannedAt', { when: dt(ba) })));
|
||
var dl = h('dl', 'ipx-ses-dl');
|
||
function row(k, content) { if (content) dl.appendChild(h('div', 'ipx-ses-r', h('dt', null, t(k)), h('dd', null, content))); }
|
||
var doms = arr(s.domains).filter(function (x) { return typeof x === 'string'; }), hosts = arr(s.hosts).filter(function (x) { return typeof x === 'string'; });
|
||
var tg = (doms.length ? doms : hosts).slice(0, 8);
|
||
if (tg.length) row('ip.ses.targets', chipList(tg, function (x) { return h('span', 'ipx-tag ipx-mono', clip(x, 60)); }));
|
||
var cats = entries(s.cats);
|
||
if (cats.length) row('ip.ses.cats', chipList(cats.slice(0, 8), function (e) { var c = pick(KNOWN_CATS, e[0], 'ok'); return h('span', 'ipx-cat ipx-bg-' + c, catLabel(e[0]) + (e[1] ? ' ' + N(e[1]) : '')); }));
|
||
var fams = entries(s.fams);
|
||
if (fams.length) row('ip.ses.fams', chipList(fams.slice(0, 8), function (e) { return h('span', 'ipx-tag', famLabel(e[0]) + (e[1] ? ' ' + N(e[1]) : '')); }));
|
||
var techs = arr(s.techs).filter(function (x) { return typeof x === 'string'; });
|
||
if (techs.length) row('ip.ses.techs', chipList(techs.slice(0, 10), function (id) {
|
||
var u = mitreURL(id);
|
||
return u ? h('a', 'ipx-tag ipx-mono lnk', { href: u, target: '_blank', rel: 'noopener noreferrer', title: t('ip.tech.open', { id: id }) }, clip(id, 14)) : h('span', 'ipx-tag ipx-mono', clip(id, 14));
|
||
}));
|
||
if (s.campaign_id && /^[A-Za-z0-9_.:-]{1,64}$/.test(str(s.campaign_id))) row('ip.ses.campaign', h('a', 'ipx-tag ipx-mono lnk', { href: campHref(s.campaign_id, start - 300, end + 300) }, clip(s.campaign_id, 24)));
|
||
node.appendChild(dl);
|
||
node.appendChild(h('div', 'ipx-ses-f', h('a', 'ipx-btn sm', { href: replayHref(ip, null, start - 60, end + 60) }, t('ip.ses.replay'))));
|
||
return node;
|
||
}
|
||
function eventRow(e) {
|
||
var cat = pick(KNOWN_CATS, e.cat, ''), when = ts(e.t);
|
||
var req;
|
||
if (e.cat === 'ban') req = untrusted(t(e.unban ? 'ip.ev.unban' : 'ip.ev.ban', { jail: clip(e.jail, 40) || '-' }));
|
||
else if (e.path) req = h('span', null, e.method ? h('span', 'ipx-method', clip(e.method, 8) + ' ') : null, untrusted(clip(e.path, 400)));
|
||
else if (e.user) req = untrusted(t('ip.ev.user', { user: clip(e.user, 60) }));
|
||
else req = h('span', 'ipx-faint', '-');
|
||
var target = e.domain || e.host || '';
|
||
var tr = h('tr', null,
|
||
h('td', 'nw', { 'data-label': t('ip.ev.time') }, h('time', 'ipx-num', when ? dt(when) : '-')),
|
||
h('td', null, { 'data-label': t('ip.ev.cat') }, cat ? h('span', 'ipx-cat ipx-bg-' + cat, catLabel(cat)) : h('span', 'ipx-faint', '-')),
|
||
h('td', null, { 'data-label': t('ip.ev.target') }, target ? h('span', 'ipx-mono', clip(target, 80)) : h('span', 'ipx-faint', '-')),
|
||
h('td', 'ipx-td-req', { 'data-label': t('ip.ev.request') }, req),
|
||
h('td', 'nw ipx-num', { 'data-label': t('ip.ev.status') }, e.status ? String(num(e.status)) : '-'),
|
||
h('td', 'nw ipx-num', { 'data-label': t('ip.ev.bytes') }, has(e.bytes) && e.bytes !== 0 ? bytes(e.bytes) : '-'));
|
||
return tr;
|
||
}
|
||
function eventsBlock(s) {
|
||
var box = h('div', 'ipx-block ipx-evs');
|
||
var body = h('div', 'ipx-ev-b');
|
||
box.appendChild(body);
|
||
s.evBox = body;
|
||
paintEvents(s);
|
||
return box;
|
||
}
|
||
function paintEvents(s) {
|
||
var box = s.evBox, ev = s.ev;
|
||
if (!box) return;
|
||
clear(box);
|
||
if (!ev.loaded && ev.loading) { box.appendChild(h('p', 'ipx-muted', t('ip.ev.loading'))); return; }
|
||
if (ev.disabled) { box.appendChild(emptyState(t('ip.ev.disabled'))); return; }
|
||
if (ev.failed && !ev.rows.length) { box.appendChild(emptyState(s.data && totalEvents(s.data) ? nologText(s.data) : t('ip.ev.unavailable'))); return; }
|
||
if (!ev.rows.length) { box.appendChild(emptyState(s.data && totalEvents(s.data) ? nologText(s.data) : t('ip.ev.empty'))); return; }
|
||
var present = [];
|
||
ev.rows.forEach(function (e) { if (e.cat && present.indexOf(e.cat) < 0 && KNOWN_CATS.indexOf(e.cat) >= 0) present.push(e.cat); });
|
||
if (ev.filter && present.indexOf(ev.filter) < 0) ev.filter = '';
|
||
if (present.length > 1) {
|
||
var sel = h('select', 'ipx-sel', { id: 'ipx-evf' });
|
||
sel.appendChild(h('option', null, { value: '' }, t('ip.ev.filter.all')));
|
||
present.forEach(function (c) { var o = h('option', null, { value: c }, catLabel(c)); if (c === ev.filter) o.selected = true; sel.appendChild(o); });
|
||
sel.addEventListener('change', function () { ev.filter = sel.value; paintEvents(s); var n = document.getElementById('ipx-evf'); if (n) n.focus(); });
|
||
box.appendChild(h('div', 'ipx-evbar', h('label', 'ipx-evl', { for: 'ipx-evf' }, t('ip.ev.filter')), sel));
|
||
}
|
||
var rows = ev.rows.filter(function (e) { return !ev.filter || e.cat === ev.filter; });
|
||
if (!rows.length) { box.appendChild(emptyState(t('ip.ev.filter.none'))); return; }
|
||
var tb = h('tbody');
|
||
rows.forEach(function (e) { tb.appendChild(eventRow(e)); });
|
||
var table = h('table', 'ipx-tbl ipx-ctbl ipx-evt', h('thead', null, h('tr', null,
|
||
h('th', null, t('ip.ev.time')), h('th', null, t('ip.ev.cat')), h('th', null, t('ip.ev.target')), h('th', null, t('ip.ev.request')),
|
||
h('th', null, t('ip.ev.status')), h('th', null, t('ip.ev.bytes')))), tb);
|
||
box.appendChild(h('div', 'ipx-tbl-w', table));
|
||
var foot = h('div', 'ipx-ev-f', h('span', 'ipx-faint ipx-num', t('ip.ev.shown', { n: N(ev.rows.length) })));
|
||
box.appendChild(foot);
|
||
var pg = U.ui.pager({ page: ev.page, pages: ev.pages, total: ev.total, onPage: function (n) { U.setParam('p', n); ev.page = n; loadEvents(s); } });
|
||
if (pg) box.appendChild(pg);
|
||
}
|
||
function loadEvents(s) {
|
||
var ev = s.ev;
|
||
if (ev.loading) return;
|
||
ev.loading = true; ev.failed = false;
|
||
var my = ++ev.seq;
|
||
var p = rParams(s.ctx);
|
||
var q = { ip: s.ip, per_page: 25, page: ev.page || 1, order: 'desc' };
|
||
Object.keys(p).forEach(function (k) { q[k] = p[k]; });
|
||
paintEvents(s);
|
||
U.api('/api/v1/events', q).then(function (r) {
|
||
if (!s.alive || my !== ev.seq) return;
|
||
var rows = Array.isArray(r) ? r : arr(r && (r.events || r.items || r.rows));
|
||
if (isObj(r) && r.page > 1 && !rows.length && r.total) { ev.loading = false; ev.page = r.pages || 1; U.setParam('p', ev.page); loadEvents(s); return; } // stale link past the last page
|
||
ev.rows = rows.filter(isObj);
|
||
ev.total = isObj(r) ? num(r.total) : 0; ev.pages = isObj(r) && r.pages ? num(r.pages) : 1;
|
||
if (isObj(r) && r.enabled === false) ev.disabled = true;
|
||
if (s.statusPaint) s.statusPaint();
|
||
ev.loaded = true; ev.loading = false;
|
||
paintEvents(s);
|
||
}).catch(function () {
|
||
if (!s.alive || my !== ev.seq) return;
|
||
ev.loading = false; ev.failed = true; ev.loaded = true;
|
||
paintEvents(s);
|
||
});
|
||
}
|
||
function sessionsCard(d, s, ip) {
|
||
var c = card('ip.ses.title', 'ip.ses.hint', 12);
|
||
var list = arr(d.sessions).filter(isObj).sort(function (a, b) { return ts(b.start) - ts(a.start); });
|
||
if (has(d.sessions) || totalEvents(d)) {
|
||
var b = h('div', 'ipx-block');
|
||
if (estNote(d, 'sessions')) b.appendChild(estNote(d, 'sessions'));
|
||
if (!list.length) b.appendChild(emptyState(totalEvents(d) ? nologText(d) : t('ip.ses.empty')));
|
||
else {
|
||
var open = false, LIM = 4, grid = h('div', 'ipx-sessions'), tg = h('button', 'ipx-link', { type: 'button' });
|
||
var paint = function () {
|
||
clear(grid);
|
||
list.slice(0, open ? list.length : LIM).forEach(function (x) { grid.appendChild(sessionCard(x, ip)); });
|
||
tg.textContent = open ? t('ip.ses.showless') : t('ip.ses.showall', { n: list.length });
|
||
};
|
||
tg.addEventListener('click', function () { open = !open; paint(); });
|
||
paint();
|
||
b.appendChild(grid);
|
||
if (list.length > LIM) b.appendChild(tg);
|
||
}
|
||
c.body.appendChild(b);
|
||
}
|
||
return c.node;
|
||
}
|
||
function eventsCard(s) {
|
||
var c = card('ip.ev.title', 'ip.ev.hint', 12);
|
||
c.body.appendChild(eventsBlock(s));
|
||
return c.node;
|
||
}
|
||
|
||
// ---------------------------------------------------------------- E: targets and ssh credentials
|
||
function targetsBlock(d) {
|
||
var box = h('div', 'ipx-block');
|
||
box.appendChild(h('h3', 'ipx-h3', t('ip.tg.title')));
|
||
var rows = arr(d.targets).filter(isObj);
|
||
if (!rows.length) {
|
||
var hosts = arr(d.hosts).map(keyOf).filter(Boolean), doms = arr(d.domains).map(keyOf).filter(Boolean);
|
||
if (!hosts.length && !doms.length) { box.appendChild(emptyState(t('ip.tg.empty'))); return box; }
|
||
box.appendChild(chipList(doms.concat(hosts), function (x) { return h('span', 'ipx-tag ipx-mono', clip(x, 60)); }));
|
||
return box;
|
||
}
|
||
rows.sort(function (a, b) { return num(b.n) - num(a.n); });
|
||
var max = num(rows[0].n) || 1, ul = h('ul', 'ipx-bars');
|
||
rows.slice(0, 20).forEach(function (r) {
|
||
var bar = h('span', 'ipx-bar', h('i')); bar.firstChild.style.width = Math.max(2, Math.round(num(r.n) / max * 100)) + '%';
|
||
ul.appendChild(h('li', 'ipx-bar-r',
|
||
h('div', 'ipx-bar-h',
|
||
h('span', 'ipx-bar-k ipx-mono', clip(r.domain || r.host, 90)),
|
||
h('span', 'ipx-num ipx-bar-n', N(num(r.n)))),
|
||
h('div', 'ipx-bar-s ipx-faint',
|
||
r.domain && r.host ? h('span', 'ipx-mono', clip(r.host, 60)) : null,
|
||
r.service ? h('span', 'ipx-tag', clip(r.service, 30)) : null),
|
||
bar));
|
||
});
|
||
box.appendChild(ul);
|
||
return box;
|
||
}
|
||
function sshBlock(d) {
|
||
var ssh = isObj(d.ssh) ? d.ssh : {};
|
||
var users = arr(ssh.users).filter(isObj);
|
||
if (!users.length) users = arr(d.users).filter(isObj).map(function (u) { return { user: u.user || u.key, n: u.n, first: u.first, admin: u.admin }; });
|
||
var fails = Math.max(num(ssh.fails), cnt(d, 'ssh-fail'));
|
||
if (!isObj(d.ssh) && !users.length && !fails) return null;
|
||
var box = h('div', 'ipx-block');
|
||
box.appendChild(h('div', 'ipx-subline', h('h3', 'ipx-h3', t('ip.ssh.title')), fails ? badge(t('ip.ssh.fails', { n: N(fails) }), ssh.ok_after_fail ? 'danger' : 'neutral') : null));
|
||
if (!users.length) { box.appendChild(fails ? h('p', 'ipx-muted', t('ip.ssh.counters', { n: N(fails) })) : emptyState(t('ip.ssh.empty'))); }
|
||
else {
|
||
var max = Math.max.apply(null, users.map(function (u) { return num(u.n); })) || 1, ul = h('ul', 'ipx-bars ipx-users');
|
||
users.slice(0, 20).forEach(function (u, i) {
|
||
var real = !!(u.admin || u.real || u.valid || u.exists);
|
||
var bar = h('span', 'ipx-bar' + (real ? ' hot' : ''), h('i')); bar.firstChild.style.width = Math.max(2, Math.round(num(u.n) / max * 100)) + '%';
|
||
ul.appendChild(h('li', 'ipx-bar-r' + (real ? ' hot' : ''),
|
||
h('div', 'ipx-bar-h',
|
||
h('span', 'ipx-bar-k', h('span', 'ipx-faint ipx-num ipx-ord', String(i + 1) + '.'), untrusted(clip(u.user, 60)), real ? badge(t('ip.ssh.real'), 'danger') : null),
|
||
h('span', 'ipx-num ipx-bar-n', N(num(u.n)))),
|
||
ts(u.first) ? h('div', 'ipx-bar-s ipx-faint ipx-num', t('ip.ssh.first') + ': ' + dt(ts(u.first))) : null,
|
||
bar));
|
||
});
|
||
box.appendChild(ul);
|
||
}
|
||
if (estNote(d, 'ssh')) box.appendChild(estNote(d, 'ssh'));
|
||
box.appendChild(h('p', 'ipx-note', t('ip.ssh.note')));
|
||
return box;
|
||
}
|
||
function targetsCard(d) {
|
||
var hasT = has(d.targets) || has(d.hosts) || has(d.domains), ssh = sshBlock(d);
|
||
if (!hasT && !ssh) return null;
|
||
var c = card('ip.tg.title', 'ip.tg.hint', 6);
|
||
if (hasT) c.body.appendChild(targetsBlock(d));
|
||
if (ssh) c.body.appendChild(ssh);
|
||
return c.node;
|
||
}
|
||
|
||
// ---------------------------------------------------------------- F: clients
|
||
function uaBlock(text) {
|
||
var full = str(text), LIM = 160, open = false;
|
||
var span = untrusted(clip(full, LIM));
|
||
var box = h('div', 'ipx-ua', span);
|
||
if (full.length > LIM) {
|
||
var b = h('button', 'ipx-link', { type: 'button' }, t('ip.cl.expand'));
|
||
b.addEventListener('click', function () {
|
||
open = !open;
|
||
span.textContent = open ? full.slice(0, 2000) : clip(full, LIM);
|
||
b.textContent = open ? t('ip.cl.collapse') : t('ip.cl.expand');
|
||
});
|
||
box.appendChild(b);
|
||
}
|
||
return box;
|
||
}
|
||
// codes per class from one source: status_hist (codes or classes), statuses, or the loaded events
|
||
function statusData(d, rows) {
|
||
var codes = {}, cls = {}, hist = isObj(d.status_hist) ? d.status_hist : {}, src = 'server';
|
||
Object.keys(hist).forEach(function (k) {
|
||
var n = num(hist[k]), m = /^([2-5])xx$/.exec(k);
|
||
if (m) cls[m[1]] = n;
|
||
else { var code = parseInt(k, 10); if (code >= 100 && code < 600 && n > 0) codes[code] = n; }
|
||
});
|
||
arr(d.statuses).forEach(function (x) { if (isObj(x)) { var code = parseInt(x.key, 10), n = num(x.n); if (code >= 100 && code < 600 && n > 0 && !codes[code]) codes[code] = n; } });
|
||
var any = Object.keys(codes).length || Object.keys(cls).some(function (k) { return cls[k] > 0; });
|
||
if (!any && rows && rows.length) {
|
||
src = 'events';
|
||
rows.forEach(function (e) { var code = num(e.status); if (code >= 100 && code < 600) codes[code] = (codes[code] || 0) + 1; });
|
||
}
|
||
var sums = {};
|
||
Object.keys(codes).forEach(function (k) { var c = String(Math.floor(k / 100)); sums[c] = (sums[c] || 0) + codes[k]; });
|
||
['2', '3', '4', '5'].forEach(function (c) { if (!(cls[c] > 0)) cls[c] = sums[c] || 0; });
|
||
return { codes: codes, cls: cls, src: src };
|
||
}
|
||
function statusMatrix(sd) {
|
||
var total = 0;
|
||
['2', '3', '4', '5'].forEach(function (c) { total += sd.cls[c] || 0; });
|
||
var ul = h('ul', 'ipx-matrix');
|
||
['2', '3', '4', '5'].forEach(function (cl) {
|
||
var sum = sd.cls[cl] || 0;
|
||
var list = Object.keys(sd.codes).filter(function (k) { return String(Math.floor(k / 100)) === cl; }).map(function (k) { return [+k, sd.codes[k]]; }).sort(function (a, b) { return b[1] - a[1]; });
|
||
var chips = h('span', 'ipx-tags');
|
||
list.slice(0, 10).forEach(function (x) { chips.appendChild(h('span', 'ipx-tag ipx-num ipx-sc' + cl, String(x[0]) + ' \u00b7 ' + N(x[1]))); });
|
||
var bar = h('span', 'ipx-bar ipx-sc' + cl, h('i')); bar.firstChild.style.width = (sum && total ? Math.max(2, Math.round(sum / total * 100)) : 0) + '%';
|
||
ul.appendChild(h('li', 'ipx-mx-r' + (sum ? '' : ' zero'),
|
||
h('div', 'ipx-bar-h', h('span', 'ipx-bar-k', t('ip.cl.class.' + cl)), h('span', 'ipx-num ipx-bar-n', N(sum))),
|
||
bar, list.length ? chips : null));
|
||
});
|
||
return { list: ul, total: total };
|
||
}
|
||
var BROWSER = /firefox|chrome|chromium|safari|edge|opera|brave|desktop|mobile|tablet|windows|linux|macos|mac os|android|\bios\b|iphone|ipad/i;
|
||
var TOOLISH = /\(tool\)|tool|scanner|crawler|bot\b|spider|sqlmap|nuclei|nikto|nmap|masscan|zgrab|curl|wget|python|go-http|java\/|libwww|hydra|burp|dirbuster|gobuster|ffuf|wpscan/i;
|
||
function isBrowserLabel(x) { return BROWSER.test(x) && !TOOLISH.test(x); }
|
||
function clientsCard(d) {
|
||
var tools = isObj(d.tools) ? d.tools : null, hist = isObj(d.status_hist) || arr(d.statuses).length || totalEvents(d) ? true : null;
|
||
var uas = tools ? arr(tools.uas) : arr(d.uas);
|
||
if (!tools && !hist && !uas.length) return null;
|
||
var c = card('ip.cl.title', 'ip.cl.hint', 6);
|
||
var b = h('div', 'ipx-block');
|
||
b.appendChild(h('h3', 'ipx-h3', t('ip.cl.uas')));
|
||
var list = uas.map(function (u) { return isObj(u) ? str(u.key || u.ua) : keyOf(u); }).filter(Boolean);
|
||
if (!list.length) b.appendChild(h('p', 'ipx-muted', t('ip.cl.uas.empty')));
|
||
else {
|
||
b.appendChild(h('p', 'ipx-faint ipx-warnline', t('ip.untrusted')));
|
||
list.slice(0, 12).forEach(function (u) { b.appendChild(uaBlock(u)); });
|
||
}
|
||
c.body.appendChild(b);
|
||
if (tools) {
|
||
if (tools.forged) c.body.appendChild(h('div', 'ipx-banner tone-warn ipx-banner-sm', h('strong', null, t('ip.cl.forged')), h('p', 'ipx-banner-p', t('ip.cl.forged.body'))));
|
||
if (tools.rotation) {
|
||
var rn = num(tools.rotation);
|
||
c.body.appendChild(h('div', 'ipx-banner tone-warn ipx-banner-sm', h('strong', null, t('ip.cl.rotation')), h('p', 'ipx-banner-p', rn > 1 ? t('ip.cl.rotation.body', { n: N(rn) }) : t('ip.cl.rotation.yes'))));
|
||
}
|
||
var labels = arr(tools.labels).filter(function (x) { return typeof x === 'string'; });
|
||
var toolsL = labels.filter(function (x) { return !isBrowserLabel(x); }), clientsL = labels.filter(isBrowserLabel);
|
||
var lb = h('div', 'ipx-block');
|
||
lb.appendChild(h('h3', 'ipx-h3', t('ip.cl.labels')));
|
||
lb.appendChild(toolsL.length ? chipList(toolsL.slice(0, 20), function (x) { return badge(clip(x, 40), 'warn'); }) : h('p', 'ipx-muted', t('ip.cl.labels.empty')));
|
||
c.body.appendChild(lb);
|
||
if (clientsL.length) {
|
||
var ib = h('div', 'ipx-block');
|
||
ib.appendChild(h('h3', 'ipx-h3', t('ip.cl.interp')));
|
||
ib.appendChild(chipList(clientsL.slice(0, 20), function (x) { return badge(clip(x, 40), 'neutral'); }));
|
||
c.body.appendChild(ib);
|
||
}
|
||
}
|
||
{
|
||
var sb = h('div', 'ipx-block');
|
||
sb.appendChild(h('h3', 'ipx-h3', t('ip.cl.status')));
|
||
var sbody = h('div');
|
||
sb.appendChild(sbody);
|
||
var paintSt = function () {
|
||
clear(sbody);
|
||
var sd = statusData(d, S && S.ev ? S.ev.rows : []), m = statusMatrix(sd);
|
||
if (m.total) { sbody.appendChild(m.list); if (sd.src === 'events') sbody.appendChild(h('p', 'ipx-faint ipx-est', t('ip.cl.status.fromEvents', { n: N(S.ev.rows.length) }))); }
|
||
else sbody.appendChild(h('p', 'ipx-muted', totalEvents(d) ? nologText(d) : t('ip.cl.status.empty')));
|
||
};
|
||
paintSt();
|
||
if (S) S.statusPaint = paintSt;
|
||
c.body.appendChild(sb);
|
||
}
|
||
return c.node;
|
||
}
|
||
|
||
// ---------------------------------------------------------------- G: related
|
||
function ipLink(ip, level, last) {
|
||
var lv = levelOf(level);
|
||
return h('a', 'ipx-rel', { href: '#/ip/' + encodeURIComponent(ip), title: t('ip.rel.open', { ip: ip }) },
|
||
h('span', 'ipx-dot tone-' + LEVEL_TONE[lv], { title: t('ip.level.' + lv) }),
|
||
h('span', 'ipx-mono ipx-rel-ip', ip),
|
||
h('span', 'ipx-faint ipx-rel-l', t('ip.level.' + lv) + (ts(last) ? ' · ' + ago(ts(last)) : '')));
|
||
}
|
||
function relatedCard(d) {
|
||
var r = isObj(d.related) ? d.related : null, nb = isObj(d.neighbors) ? d.neighbors : null;
|
||
if (!r && !nb) return null;
|
||
r = r || {};
|
||
var c = card('ip.rel.title', 'ip.rel.hint', 12);
|
||
var grid = h('div', 'ipx-relgrid');
|
||
var b1 = h('div', 'ipx-block');
|
||
b1.appendChild(h('h3', 'ipx-h3', t('ip.rel.prefix')));
|
||
var sp = arr(r.same_prefix).filter(function (x) { return isObj(x) && validIP(x.ip) && x.ip !== S.ip; });
|
||
if (!sp.length) b1.appendChild(h('p', 'ipx-muted', t('ip.rel.prefix.empty')));
|
||
else { var ul = h('ul', 'ipx-rels'); sp.slice(0, 24).forEach(function (x) { ul.appendChild(h('li', null, ipLink(x.ip, x.level, x.last))); }); b1.appendChild(ul); }
|
||
var b2 = h('div', 'ipx-block');
|
||
b2.appendChild(h('h3', 'ipx-h3', t('ip.rel.asn')));
|
||
var an = num(has(r.same_asn_n) ? r.same_asn_n : nb && nb.asn_n);
|
||
b2.appendChild(an > 0 ? h('p', 'ipx-bigp ipx-num', pl('ip.rel.asn.n', an)) : h('p', 'ipx-muted', t('ip.rel.asn.none')));
|
||
var b3 = h('div', 'ipx-block');
|
||
b3.appendChild(h('h3', 'ipx-h3', t('ip.rel.campaigns')));
|
||
var rg = isObj(d.range) ? d.range : {}, tmm = isObj(d.time) ? d.time : {};
|
||
var cFrom = ts(rg.from) || ts(tmm.first) || ts(d.first), cTo = ts(rg.to) || ts(tmm.last) || ts(d.last) || Math.floor(Date.now() / 1000);
|
||
var cs = arr(r.campaigns).filter(function (x) { return isObj(x) && /^[A-Za-z0-9_.:-]{1,64}$/.test(str(x.id)); });
|
||
if (!cs.length) b3.appendChild(h('p', 'ipx-muted', t('ip.rel.campaigns.empty')));
|
||
else {
|
||
var cl = h('ul', 'ipx-rels');
|
||
cs.slice(0, 12).forEach(function (x) { cl.appendChild(h('li', null, h('a', 'ipx-rel', { href: campHref(x.id, cFrom, cTo) }, h('span', 'ipx-mono ipx-rel-ip', clip(x.id, 24)), h('span', 'ipx-faint ipx-rel-l', pl('ip.rel.campaign.ips', num(x.ips_n)))))); });
|
||
b3.appendChild(cl);
|
||
}
|
||
grid.appendChild(b1); grid.appendChild(b2); grid.appendChild(b3);
|
||
c.body.appendChild(grid);
|
||
return c.node;
|
||
}
|
||
|
||
// ---------------------------------------------------------------- page assembly
|
||
function tocItem(s, id, key) {
|
||
var b = h('a', 'ipx-toc-a', { href: location.hash || '#/ip', 'data-sec': id }, t(key));
|
||
b.addEventListener('click', function (e) {
|
||
e.preventDefault();
|
||
var node = document.getElementById('ipx-' + id);
|
||
if (!node) return;
|
||
var smooth = !(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);
|
||
node.scrollIntoView({ behavior: smooth ? 'smooth' : 'auto', block: 'start' });
|
||
try { node.focus({ preventScroll: true }); } catch (x) { /* old browser */ }
|
||
});
|
||
return b;
|
||
}
|
||
function watchToc(s, toc, items) {
|
||
if (!('IntersectionObserver' in window)) return;
|
||
var visible = {};
|
||
var io = new IntersectionObserver(function (entries) {
|
||
entries.forEach(function (en) { visible[en.target.id] = en.isIntersecting; });
|
||
var cur = null;
|
||
for (var i = 0; i < items.length; i++) if (visible['ipx-' + items[i]]) { cur = items[i]; break; }
|
||
if (!cur) return;
|
||
toc.querySelectorAll('.ipx-toc-a').forEach(function (a) {
|
||
if (a.getAttribute('data-sec') === cur) {
|
||
a.setAttribute('aria-current', 'true');
|
||
var sc = a.parentNode.parentNode;
|
||
if (sc && sc.scrollWidth > sc.clientWidth && sc.scrollTo) {
|
||
var li = a.parentNode;
|
||
sc.scrollTo({ left: li.offsetLeft - sc.clientWidth / 2 + li.clientWidth / 2, behavior: 'auto' });
|
||
}
|
||
} else a.removeAttribute('aria-current');
|
||
});
|
||
}, { rootMargin: '-15% 0px -70% 0px', threshold: 0 });
|
||
items.forEach(function (id) { var n = document.getElementById('ipx-' + id); if (n) io.observe(n); });
|
||
s.cleanup.push(function () { io.disconnect(); });
|
||
}
|
||
function watchScrollFade(s, nav) {
|
||
var sc = nav.firstChild;
|
||
function upd() {
|
||
nav.classList.toggle('fade-l', sc.scrollLeft > 4);
|
||
nav.classList.toggle('fade-r', sc.scrollLeft + sc.clientWidth < sc.scrollWidth - 4);
|
||
}
|
||
sc.addEventListener('scroll', upd, { passive: true });
|
||
window.addEventListener('resize', upd);
|
||
s.cleanup.push(function () { window.removeEventListener('resize', upd); });
|
||
setTimeout(upd, 0);
|
||
}
|
||
|
||
function headBar(s) {
|
||
var back = h('a', 'ipx-back', { href: '#/ips', 'aria-label': t('ip.back.label') }, h('span', 'ipx-back-a', { 'aria-hidden': 'true' }, '←'), ' ' + t('ip.back'));
|
||
return h('div', 'ipx-head', back, h('span', 'ipx-period ipx-faint', t('ip.period', { range: rLabel(s.ctx) })));
|
||
}
|
||
|
||
function shell(s) {
|
||
clear(s.root);
|
||
dispose(s);
|
||
var wrap = h('div', 'ipx');
|
||
s.view = wrap;
|
||
s.root.appendChild(wrap);
|
||
return wrap;
|
||
}
|
||
function showState(s, node) {
|
||
var wrap = shell(s);
|
||
wrap.appendChild(headBar(s));
|
||
wrap.appendChild(node);
|
||
}
|
||
function loadingNode() {
|
||
return h('div', 'ipx-card ipx-skel', { role: 'status', 'aria-live': 'polite' },
|
||
h('p', 'ipx-muted', t('ip.loading')),
|
||
h('div', 'ipx-skel-b'), h('div', 'ipx-skel-b short'), h('div', 'ipx-skel-b'));
|
||
}
|
||
function errorNode(s, key, withRetry) {
|
||
var box = h('div', 'ipx-card state-error ipx-state', h('p', 'ipx-empty-t', t(key)), key === 'ip.notfound' ? h('p', 'ipx-empty-h', t('ip.notfound.hint')) : null);
|
||
if (withRetry) {
|
||
var b = h('button', 'ipx-btn', { type: 'button' }, t('ip.retry'));
|
||
b.addEventListener('click', function () { load(s); });
|
||
box.appendChild(b);
|
||
}
|
||
return box;
|
||
}
|
||
|
||
function render(s) {
|
||
var d = s.data, ip = s.ip;
|
||
var wrap = shell(s);
|
||
wrap.appendChild(headBar(s));
|
||
var hero = safe(function () { return heroCard(d, ip, s.ctx); });
|
||
if (hero) wrap.appendChild(hero);
|
||
var tocScroll = h('ul', 'ipx-toc-l');
|
||
var toc = h('nav', 'ip-toc ipx-toc', { 'aria-label': t('ip.toc') }, tocScroll);
|
||
var grid = h('div', 'ipx-grid');
|
||
var items = [];
|
||
function add(id, key, node) {
|
||
if (!node) return;
|
||
node.id = 'ipx-' + id;
|
||
node.setAttribute('tabindex', '-1');
|
||
grid.appendChild(node);
|
||
items.push(id);
|
||
tocScroll.appendChild(h('li', null, tocItem(s, id, key)));
|
||
}
|
||
add('summary', 'ip.sec.summary', safe(function () { return summaryCard(d, ip, s.ctx); }));
|
||
add('activity', 'ip.sec.activity', safe(function () { return activityCard(d); }));
|
||
add('attack', 'ip.sec.attack', safe(function () { return attackCard(d); }));
|
||
add('sessions', 'ip.sec.sessions', safe(function () { return sessionsCard(d, s, ip); }));
|
||
add('defense', 'ip.sec.defense', safe(function () { return defenseCard(d); }));
|
||
add('identity', 'ip.sec.identity', safe(function () { return identityCard(d); }));
|
||
add('related', 'ip.sec.related', safe(function () { return relatedCard(d); }));
|
||
add('events', 'ip.sec.events', safe(function () { return eventsCard(s); }));
|
||
wrap.appendChild(toc);
|
||
wrap.appendChild(grid);
|
||
watchToc(s, toc, items);
|
||
watchScrollFade(s, toc);
|
||
}
|
||
|
||
function load(s) {
|
||
var my = ++s.seq;
|
||
s.ip = ipFromCtx(s.ctx);
|
||
s.key = ctxKey(s.ctx);
|
||
s.ev = { rows: [], page: U.pageParam(), pages: 1, total: 0, loading: false, failed: false, loaded: false, disabled: !!(isObj(s.data && s.data.log) && s.data.log.available === false), seq: s.ev.seq + 1 };
|
||
if (!validIP(s.ip)) { showState(s, errorNode(s, 'ip.invalid', false)); return; }
|
||
document.title = s.ip + ' · ' + t('ip.title') + ' · Urutau';
|
||
if (!s.data) showState(s, loadingNode());
|
||
U.api('/api/v1/ip/' + encodeURIComponent(s.ip), rParams(s.ctx)).then(function (d) {
|
||
if (!s.alive || my !== s.seq) return;
|
||
if (!isObj(d)) throw new Error('bad payload');
|
||
s.data = d;
|
||
s.ev.disabled = !!(isObj(d.log) && d.log.available === false);
|
||
render(s);
|
||
if (!s.ev.disabled) loadEvents(s);
|
||
}).catch(function (e) {
|
||
if (!s.alive || my !== s.seq) return;
|
||
if (e && e.message === 'unauthorized') return;
|
||
s.data = null;
|
||
showState(s, errorNode(s, e && e.status === 404 ? 'ip.notfound' : 'ip.error', !(e && e.status === 404)));
|
||
});
|
||
}
|
||
|
||
// ---------------------------------------------------------------- registration
|
||
U.registerPage({
|
||
id: 'ip',
|
||
hidden: true,
|
||
nav: false,
|
||
titleKey: 'ip.title',
|
||
icon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><circle cx="11" cy="11" r="6"/><path d="M20 20l-4.2-4.2"/></svg>',
|
||
mount: function (root, ctx) {
|
||
S = newState(root, ctx);
|
||
load(S);
|
||
},
|
||
update: function (ctx) {
|
||
if (!S) return;
|
||
var prevLang = S.lang;
|
||
S.ctx = ctx; S.lang = ctx.lang;
|
||
if (ctxKey(ctx) !== S.key) { S.data = S.data && ipFromCtx(ctx) === S.ip ? S.data : null; load(S); return; }
|
||
if (ctx.lang !== prevLang && S.data) { render(S); paintEvents(S); }
|
||
else if (S.data && !S.ev.disabled && S.ev.page !== U.pageParam()) { S.ev.page = U.pageParam(); loadEvents(S); } // back/forward
|
||
},
|
||
unmount: function () {
|
||
if (!S) return;
|
||
S.alive = false; S.seq++;
|
||
dispose(S);
|
||
clear(S.root);
|
||
S = null;
|
||
}
|
||
});
|
||
})();
|