diff --git a/src/lib/components/global/Icon.svelte b/src/lib/components/global/Icon.svelte index 099a93e..aa4b89c 100644 --- a/src/lib/components/global/Icon.svelte +++ b/src/lib/components/global/Icon.svelte @@ -6,9 +6,10 @@ interface Props { name: string; size?: 'xs' | 'sm' | 'md' | 'lg'; + animate?: 'spin' | 'pulse' | 'pulse-once' | 'bounce' | 'fade' | null; } - let { name, size = 'md' }: Props = $props(); + let { name, size = 'md', animate = null }: Props = $props(); const sizeClasses = { xs: 'w-2 h-2', @@ -28,7 +29,7 @@ */ -
+
{#if name === 'calculator'} @@ -225,6 +226,8 @@ {:else if name === 'map-pin'} + {:else if name === 'activity'} + {:else if name === 'arrow-up-down'} @@ -273,7 +276,43 @@ {:else if name === 'ref-mtu-mss'} - + + {:else if name === 'dns-lookup'} + + {:else if name === 'dns-reverse'} + + {:else if name === 'dns-propagation'} + + {:else if name === 'dns-spf-eval'} + + {:else if name === 'dns-dmarc-check'} + + {:else if name === 'dns-caa-check'} + + {:else if name === 'dns-ns-soa'} + + {:else if name === 'http-headers'} + + {:else if name === 'redirect-trace'} + + {:else if name === 'security-headers'} + + {:else if name === 'cors-check'} + + {:else if name === 'http-perf'} + + {:else if name === 'tls-cert'} + + {:else if name === 'tls-version'} + + {:else if name === 'tls-alpn'} + + {:else if name === 'network-port'} + + {:else if name === 'network-ping'} + + {:else if name === 'something'} + {:else if name === 'case'} @@ -339,6 +378,10 @@ {:else if name === 'minus-circle'} + {:else if name === 'x-circle'} + + {:else if name === 'alert-circle'} + {:else if name === 'check-circle'} {:else if name === 'alert-triangle'} @@ -438,4 +481,79 @@ /* fill: var(--color-primary); */ fill: currentColor; } + + /* Icon animations */ + .animate-spin { + animation: icon-spin 1s linear infinite; + } + + .animate-pulse { + animation: icon-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; + } + + .animate-pulse-once { + animation: icon-pulse-once 1s cubic-bezier(0.4, 0, 0.6, 1); + } + + .animate-bounce { + animation: icon-bounce 1s infinite; + } + + .animate-fade { + animation: icon-fade 2s ease-in-out infinite; + } + + @keyframes icon-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } + } + + @keyframes icon-pulse { + 0%, 100% { + opacity: 1; + } + 50% { + opacity: 0.5; + } + } + + @keyframes icon-pulse-once { + 0% { + opacity: 1; + } + 50% { + opacity: 0.3; + } + 100% { + opacity: 1; + } + } + + @keyframes icon-bounce { + 0%, 20%, 53%, 80%, 100% { + transform: translate3d(0, 0, 0); + } + 40%, 43% { + transform: translate3d(0, -8px, 0); + } + 70% { + transform: translate3d(0, -4px, 0); + } + 90% { + transform: translate3d(0, -2px, 0); + } + } + + @keyframes icon-fade { + 0%, 100% { + opacity: 1; + } + 50% { + opacity: 0.3; + } + } diff --git a/src/lib/constants/nav.ts b/src/lib/constants/nav.ts index a7fbeed..a0af999 100644 --- a/src/lib/constants/nav.ts +++ b/src/lib/constants/nav.ts @@ -665,6 +665,51 @@ export const SUB_NAV: Record = { keywords: ['http', 'performance', 'timing', 'dns', 'tcp', 'tls', 'ttfb', 'metrics', 'analyzer'] } ] + }, + { + title: 'TLS Diagnostics', + items: [ + { + href: '/diagnostics/tls/certificate', + label: 'TLS Certificate Analyzer', + description: 'Analyze TLS certificates, view certificate chains, check expiration dates, and examine Subject Alternative Names', + icon: 'tls-cert', + keywords: ['tls', 'certificate', 'analyzer', 'chain', 'expiry', 'san', 'ssl', 'x509', 'fingerprint'] + }, + { + href: '/diagnostics/tls/versions', + label: 'TLS Versions Probe', + description: 'Test which TLS protocol versions a server supports and assess overall security posture', + icon: 'tls-version', + keywords: ['tls', 'versions', 'probe', 'security', 'protocol', 'support', 'deprecated', 'assessment'] + }, + { + href: '/diagnostics/tls/alpn', + label: 'TLS ALPN Negotiation', + description: 'Test Application-Layer Protocol Negotiation to see which protocol a server selects (HTTP/2, HTTP/3)', + icon: 'tls-alpn', + keywords: ['tls', 'alpn', 'negotiation', 'http2', 'http3', 'protocol', 'handshake', 'application'] + } + ] + }, + { + title: 'Network Diagnostics', + items: [ + { + href: '/diagnostics/network/tcp-port-check', + label: 'TCP Port Checker', + description: 'Test TCP connectivity to host:port combinations and measure connection latency', + icon: 'network-port', + keywords: ['tcp', 'port', 'check', 'connectivity', 'latency', 'open', 'closed', 'firewall', 'scan'] + }, + { + href: '/diagnostics/network/http-ping', + label: 'HTTP Ping', + description: 'Measure HTTP/HTTPS response latency with statistical analysis (median, p95) without raw ICMP', + icon: 'network-ping', + keywords: ['http', 'ping', 'latency', 'response', 'time', 'statistics', 'median', 'p95', 'web', 'api'] + } + ] } ], '/reference': [ diff --git a/src/routes/api/internal/diagnostics/dns/+server.ts b/src/routes/api/internal/diagnostics/dns/+server.ts index 30dac75..f4b603c 100644 --- a/src/routes/api/internal/diagnostics/dns/+server.ts +++ b/src/routes/api/internal/diagnostics/dns/+server.ts @@ -345,7 +345,10 @@ async function checkDMARC(domain: string): Promise { try { const dmarcDomain = `_dmarc.${domain}`; const result = await performDNSLookup(dmarcDomain, 'TXT'); - const dmarcRecord = result.Answer?.find((record: any) => record.data.startsWith('v=DMARC1')); + const dmarcRecord = result.Answer?.find((record: any) => { + const cleanData = record.data.replace(/^"(.*)"$/, '$1'); // Remove surrounding quotes + return cleanData.startsWith('v=DMARC1'); + }); if (!dmarcRecord) { return { @@ -355,7 +358,7 @@ async function checkDMARC(domain: string): Promise { }; } - const policy = dmarcRecord.data; + const policy = dmarcRecord.data.replace(/^"(.*)"$/, '$1'); // Clean the policy data const parsed = { policy: policy.match(/p=([^;]+)/)?.[1], subdomainPolicy: policy.match(/sp=([^;]+)/)?.[1], diff --git a/src/routes/api/internal/diagnostics/network/+server.ts b/src/routes/api/internal/diagnostics/network/+server.ts new file mode 100644 index 0000000..ef55df1 --- /dev/null +++ b/src/routes/api/internal/diagnostics/network/+server.ts @@ -0,0 +1,280 @@ +import { json, error } from '@sveltejs/kit'; +import * as net from 'node:net'; +import type { RequestHandler } from './$types'; + +type Action = "tcp-port-check" | "http-ping"; + +interface BaseReq { action: Action; } + +interface TcpPortCheckReq extends BaseReq { + action: "tcp-port-check"; + targets: string[]; // Array of host:port strings + timeout?: number; +} + +interface HttpPingReq extends BaseReq { + action: "http-ping"; + url: string; + count?: number; + method?: string; + timeout?: number; +} + +type RequestBody = TcpPortCheckReq | HttpPingReq; + +function parseHostPort(hostPort: string): { host: string; port: number } { + const match = hostPort.match(/^(.+?):(\d+)$/); + if (match) { + return { host: match[1], port: parseInt(match[2], 10) }; + } + throw new Error(`Invalid host:port format: ${hostPort}`); +} + +async function checkTcpPort(host: string, port: number, timeout: number = 5000): Promise<{ + host: string; + port: number; + open: boolean; + latency: number | null; + error: string | null; +}> { + return new Promise((resolve) => { + const startTime = Date.now(); + + const socket = new net.Socket(); + let resolved = false; + + const cleanup = () => { + if (!resolved) { + resolved = true; + socket.destroy(); + } + }; + + const timeoutHandle = setTimeout(() => { + cleanup(); + resolve({ + host, + port, + open: false, + latency: null, + error: 'Connection timeout' + }); + }, timeout); + + socket.setTimeout(timeout); + + socket.on('connect', () => { + const latency = Date.now() - startTime; + clearTimeout(timeoutHandle); + cleanup(); + resolve({ + host, + port, + open: true, + latency, + error: null + }); + }); + + socket.on('error', (err) => { + clearTimeout(timeoutHandle); + cleanup(); + resolve({ + host, + port, + open: false, + latency: null, + error: err.message + }); + }); + + socket.on('timeout', () => { + clearTimeout(timeoutHandle); + cleanup(); + resolve({ + host, + port, + open: false, + latency: null, + error: 'Socket timeout' + }); + }); + + socket.connect(port, host); + }); +} + +async function httpPing(url: string, count: number = 5, method: string = 'HEAD', timeout: number = 10000): Promise<{ + url: string; + method: string; + count: number; + successful: number; + failed: number; + latencies: number[]; + statistics: { + min: number; + max: number; + avg: number; + median: number; + p95: number; + }; + errors: string[]; +}> { + const latencies: number[] = []; + const errors: string[] = []; + + for (let i = 0; i < count; i++) { + try { + const startTime = Date.now(); + + const response = await fetch(url, { + method: method.toUpperCase(), + signal: AbortSignal.timeout(timeout), + // Don't follow redirects for more consistent timing + redirect: 'manual' + }); + + const latency = Date.now() - startTime; + latencies.push(latency); + + // Consume the response to ensure complete timing + if (method.toLowerCase() !== 'head') { + await response.text(); + } + } catch (err: any) { + errors.push(err.message); + } + + // Small delay between requests to avoid overwhelming the server + if (i < count - 1) { + await new Promise(resolve => setTimeout(resolve, 100)); + } + } + + const successful = latencies.length; + const failed = count - successful; + + // Calculate statistics + let statistics = { + min: 0, + max: 0, + avg: 0, + median: 0, + p95: 0 + }; + + if (latencies.length > 0) { + const sorted = [...latencies].sort((a, b) => a - b); + statistics = { + min: Math.min(...latencies), + max: Math.max(...latencies), + avg: Math.round(latencies.reduce((sum, lat) => sum + lat, 0) / latencies.length), + median: sorted.length % 2 === 0 + ? Math.round((sorted[sorted.length / 2 - 1] + sorted[sorted.length / 2]) / 2) + : sorted[Math.floor(sorted.length / 2)], + p95: sorted[Math.floor(sorted.length * 0.95)] || sorted[sorted.length - 1] + }; + } + + return { + url, + method, + count, + successful, + failed, + latencies, + statistics, + errors + }; +} + +export const POST: RequestHandler = async ({ request }) => { + try { + const body: RequestBody = await request.json(); + + switch (body.action) { + case 'tcp-port-check': { + const { targets, timeout = 5000 } = body as TcpPortCheckReq; + + console.log('Received targets:', targets); // Debug log + console.log('Targets type:', typeof targets, 'Length:', targets?.length); // Debug log + + if (!targets || targets.length === 0) { + throw error(400, 'No targets provided'); + } + + if (targets.length > 50) { + throw error(400, 'Too many targets (max 50)'); + } + + const results = await Promise.all( + targets.map(async (target) => { + try { + const { host, port } = parseHostPort(target.trim()); + return await checkTcpPort(host, port, timeout); + } catch (err: any) { + return { + host: target, + port: 0, + open: false, + latency: null, + error: err.message + }; + } + }) + ); + + const summary = { + total: results.length, + open: results.filter(r => r.open).length, + closed: results.filter(r => !r.open).length, + avgLatency: results.filter(r => r.latency !== null).length > 0 + ? Math.round(results.filter(r => r.latency !== null) + .reduce((sum, r) => sum + (r.latency || 0), 0) / + results.filter(r => r.latency !== null).length) + : null + }; + + return json({ + targets, + timeout, + results, + summary, + timestamp: new Date().toISOString() + }); + } + + case 'http-ping': { + const { url, count = 5, method = 'HEAD', timeout = 10000 } = body as HttpPingReq; + + if (!url) { + throw error(400, 'URL is required'); + } + + if (count < 1 || count > 20) { + throw error(400, 'Count must be between 1 and 20'); + } + + // Validate URL + try { + new URL(url); + } catch { + throw error(400, 'Invalid URL format'); + } + + const result = await httpPing(url, count, method, timeout); + + return json({ + ...result, + timestamp: new Date().toISOString() + }); + } + + default: + throw error(400, `Unknown action: ${(body as any).action}`); + } + } catch (err: any) { + console.error('Network diagnostics API error:', err); + throw error(500, `Network diagnostic failed: ${err.message}`); + } +}; \ No newline at end of file diff --git a/src/routes/api/internal/diagnostics/tls/+server.ts b/src/routes/api/internal/diagnostics/tls/+server.ts new file mode 100644 index 0000000..5be0af7 --- /dev/null +++ b/src/routes/api/internal/diagnostics/tls/+server.ts @@ -0,0 +1,319 @@ +import { json, error } from '@sveltejs/kit'; +import * as tls from 'node:tls'; +import * as net from 'node:net'; +import type { RequestHandler } from './$types'; + +type Action = "certificate" | "versions" | "alpn"; + +interface BaseReq { action: Action; } + +interface CertificateReq extends BaseReq { + action: "certificate"; + host: string; + port?: number; + servername?: string; +} + +interface VersionsReq extends BaseReq { + action: "versions"; + host: string; + port?: number; + servername?: string; +} + +interface ALPNReq extends BaseReq { + action: "alpn"; + host: string; + port?: number; + servername?: string; + protocols?: string[]; +} + +type RequestBody = CertificateReq | VersionsReq | ALPNReq; + +const TLS_VERSIONS = ['TLSv1', 'TLSv1.1', 'TLSv1.2', 'TLSv1.3'] as const; + +function parseHost(hostPort: string): { host: string; port: number } { + const match = hostPort.match(/^(.+?):(\d+)$/); + if (match) { + return { host: match[1], port: parseInt(match[2], 10) }; + } + return { host: hostPort, port: 443 }; +} + +function formatCertificate(cert: any): any { + const now = Date.now(); + const validFrom = new Date(cert.valid_from).getTime(); + const validTo = new Date(cert.valid_to).getTime(); + + return { + subject: { + CN: cert.subject?.CN || '', + O: cert.subject?.O || '', + OU: cert.subject?.OU || '', + C: cert.subject?.C || '' + }, + issuer: { + CN: cert.issuer?.CN || '', + O: cert.issuer?.O || '', + C: cert.issuer?.C || '' + }, + validFrom: cert.valid_from, + validTo: cert.valid_to, + daysUntilExpiry: Math.ceil((validTo - now) / (1000 * 60 * 60 * 24)), + isExpired: now > validTo, + isNotYetValid: now < validFrom, + serialNumber: cert.serialNumber, + fingerprint: cert.fingerprint, + fingerprint256: cert.fingerprint256, + subjectAltNames: cert.subjectaltname && typeof cert.subjectaltname === 'string' + ? cert.subjectaltname.split(', ').map((san: string) => san.replace(/^DNS:/, '')) + : [], + keyUsage: cert.ext_key_usage && typeof cert.ext_key_usage === 'string' + ? cert.ext_key_usage.split(', ') + : [], + version: cert.version + }; +} + +async function getCertificateInfo(host: string, port: number, servername?: string): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => { + reject(new Error('Connection timeout')); + }, 10000); + + const options: tls.ConnectionOptions = { + host, + port, + servername: servername || host, + rejectUnauthorized: false, + timeout: 10000 + }; + + const socket = tls.connect(options, () => { + clearTimeout(timeout); + + const cert = socket.getPeerCertificate(true); + const protocol = socket.getProtocol(); + const cipher = socket.getCipher(); + let alpnProtocol = null; + + // Try the new method first (Node.js 22.12+) + if (typeof socket.getALPNProtocol === 'function') { + alpnProtocol = socket.getALPNProtocol(); + } else { + // Fallback: Check if ALPN was negotiated by accessing internal properties + try { + const tlsSocket = socket as any; + if (tlsSocket.alpnProtocol) { + alpnProtocol = tlsSocket.alpnProtocol; + } else if (tlsSocket._handle && tlsSocket._handle.getALPNProtocol) { + alpnProtocol = tlsSocket._handle.getALPNProtocol(); + } + } catch (e) { + // Ignore errors from accessing internal properties + } + } + + const chain: any[] = []; + let currentCert = cert; + + while (currentCert && Object.keys(currentCert).length > 0) { + chain.push(formatCertificate(currentCert)); + currentCert = currentCert.issuerCertificate; + // Prevent infinite loops + if (currentCert === cert || chain.length > 10) break; + } + + const result = { + chain, + protocol, + cipher: cipher ? { + name: cipher.name, + version: cipher.version, + bits: cipher.bits + } : null, + alpnProtocol, + servername: servername || host, + peerCertificate: formatCertificate(cert) + }; + + socket.end(); + resolve(result); + }); + + socket.on('error', (err) => { + clearTimeout(timeout); + reject(err); + }); + + socket.on('timeout', () => { + clearTimeout(timeout); + socket.destroy(); + reject(new Error('Connection timeout')); + }); + }); +} + +async function probeTLSVersions(host: string, port: number, servername?: string): Promise { + const results: { [key: string]: boolean } = {}; + const errors: { [key: string]: string } = {}; + + for (const version of TLS_VERSIONS) { + try { + await new Promise((resolve, reject) => { + const timeout = setTimeout(() => { + reject(new Error('Timeout')); + }, 5000); + + const options: tls.ConnectionOptions = { + host, + port, + servername: servername || host, + minVersion: version, + maxVersion: version, + rejectUnauthorized: false, + timeout: 5000 + }; + + const socket = tls.connect(options, () => { + clearTimeout(timeout); + results[version] = true; + socket.end(); + resolve(); + }); + + socket.on('error', (err) => { + clearTimeout(timeout); + results[version] = false; + errors[version] = err.message; + resolve(); + }); + + socket.on('timeout', () => { + clearTimeout(timeout); + socket.destroy(); + results[version] = false; + errors[version] = 'Timeout'; + resolve(); + }); + }); + } catch (err: any) { + results[version] = false; + errors[version] = err.message; + } + } + + const supportedVersions = Object.entries(results) + .filter(([_, supported]) => supported) + .map(([version]) => version); + + return { + supported: results, + errors, + supportedVersions, + minVersion: supportedVersions[0] || null, + maxVersion: supportedVersions[supportedVersions.length - 1] || null, + totalSupported: supportedVersions.length + }; +} + +async function probeALPN(host: string, port: number, protocols: string[], servername?: string): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => { + reject(new Error('Connection timeout')); + }, 10000); + + const options: tls.ConnectionOptions = { + host, + port, + servername: servername || host, + ALPNProtocols: protocols, + rejectUnauthorized: false, + timeout: 10000 + }; + + const socket = tls.connect(options, () => { + clearTimeout(timeout); + + let negotiatedProtocol = null; + + // Try the new method first (Node.js 22.12+) + if (typeof socket.getALPNProtocol === 'function') { + negotiatedProtocol = socket.getALPNProtocol(); + } else { + // Fallback: Check if ALPN was negotiated by accessing internal properties + // This is a workaround for older Node.js versions + try { + const tlsSocket = socket as any; + if (tlsSocket.alpnProtocol) { + negotiatedProtocol = tlsSocket.alpnProtocol; + } else if (tlsSocket._handle && tlsSocket._handle.getALPNProtocol) { + negotiatedProtocol = tlsSocket._handle.getALPNProtocol(); + } + } catch (e) { + // Ignore errors from accessing internal properties + } + } + + const tlsVersion = socket.getProtocol(); + + const result = { + requestedProtocols: protocols, + negotiatedProtocol: negotiatedProtocol || null, + tlsVersion, + success: !!negotiatedProtocol, + servername: servername || host + }; + + socket.end(); + resolve(result); + }); + + socket.on('error', (err) => { + clearTimeout(timeout); + reject(err); + }); + + socket.on('timeout', () => { + clearTimeout(timeout); + socket.destroy(); + reject(new Error('Connection timeout')); + }); + }); +} + +export const POST: RequestHandler = async ({ request }) => { + try { + const body: RequestBody = await request.json(); + + switch (body.action) { + case 'certificate': { + const { host: hostInput, port = 443, servername } = body as CertificateReq; + const { host } = parseHost(hostInput); + const result = await getCertificateInfo(host, port, servername); + return json(result); + } + + case 'versions': { + const { host: hostInput, port = 443, servername } = body as VersionsReq; + const { host } = parseHost(hostInput); + const result = await probeTLSVersions(host, port, servername); + return json(result); + } + + case 'alpn': { + const { host: hostInput, port = 443, servername, protocols = ['h2', 'http/1.1'] } = body as ALPNReq; + const { host } = parseHost(hostInput); + const result = await probeALPN(host, port, protocols, servername); + return json(result); + } + + default: + throw error(400, `Unknown action: ${(body as any).action}`); + } + } catch (err: any) { + console.error('TLS API error:', err); + throw error(500, `TLS operation failed: ${err.message}`); + } +}; \ No newline at end of file diff --git a/src/routes/diagnostics/dns/caa-effective/+page.svelte b/src/routes/diagnostics/dns/caa-effective/+page.svelte index 84fca8e..7e38107 100644 --- a/src/routes/diagnostics/dns/caa-effective/+page.svelte +++ b/src/routes/diagnostics/dns/caa-effective/+page.svelte @@ -243,7 +243,7 @@ {#if results}
-
+

CAA Policy Results

+ {#if results && results.hasRecord}
@@ -250,9 +251,10 @@
- {#if results && results.hasRecord} + + {#if results.parsed} {@const issues = getIssues()} - + {@const parsed = results.parsed}
i.severity === 'high') ? 'shield-x' : 'shield-alert'} size="md" /> @@ -276,22 +278,19 @@
- {/if} - - {#if results.record} -
-

DMARC Record

-
-
_dmarc.{domain}
- {results.record} + + {#if results.record} +
+

DMARC Record

+
+
_dmarc.{domain}
+ {results.record} +
-
- {/if} + {/if} - - {#if results.parsed} - {@const parsed = results.parsed} +

Policy Configuration

@@ -454,7 +453,7 @@ {#if results && results.hasRecord === false} -
+
@@ -540,8 +539,9 @@
\ No newline at end of file + diff --git a/src/routes/diagnostics/network/http-ping/+page.svelte b/src/routes/diagnostics/network/http-ping/+page.svelte new file mode 100644 index 0000000..0fef153 --- /dev/null +++ b/src/routes/diagnostics/network/http-ping/+page.svelte @@ -0,0 +1,697 @@ + + +
+
+

HTTP Ping

+

Measure HTTP/HTTPS response latency by sending repeated requests and analyzing timing statistics. Alternative to ICMP ping for web services and APIs.

+
+ + +
+
+ + +

HTTP Ping Examples

+
+
+ {#each examples as example, i} + + {/each} +
+
+
+ + +
+
+

HTTP Ping Configuration

+
+
+
+
+ +
+
+ + +
+
+ +
+ {#each httpMethods as methodOption} + + {/each} +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ + + {#if results} +
+
+

HTTP Ping Results

+ +
+
+ + +
+
+ +
+ {results.successful}/{results.count} +

Successful requests

+
+
+ {#if results.statistics?.avg} +
+ +
+ {results.statistics.avg}ms +

Average latency ({getLatencyDescription(results.statistics.avg)})

+
+
+ {/if} + {#if results.failed > 0} +
+ +
+ {results.failed} +

Failed requests

+
+
+ {/if} +
+ + {#if results.statistics && results.successful > 0} + +
+

Latency Statistics

+
+
+ Minimum: + {results.statistics.min}ms +
+
+ Maximum: + {results.statistics.max}ms +
+
+ Average: + {results.statistics.avg}ms +
+
+ Median: + {results.statistics.median}ms +
+
+ 95th Percentile: + {results.statistics.p95}ms +
+
+ Range: + {results.statistics.max - results.statistics.min}ms +
+
+
+ + + {#if results.latencies?.length > 0} +
+

Individual Request Results

+
+ {#each results.latencies as latency, i} +
+ #{i + 1} + {latency}ms + {getLatencyDescription(latency)} +
+ {/each} +
+
+ {/if} + {/if} + + + {#if results.errors?.length > 0} +
+

Request Errors ({results.errors.length})

+
+ {#each results.errors as error, i} +
+ #{i + results.successful + 1} + {error} +
+ {/each} +
+
+ {/if} + + +
+

Request Information

+
+
+ URL: + {results.url} +
+
+ Method: + {results.method} +
+
+ Success Rate: + {((results.successful / results.count) * 100).toFixed(1)}% +
+
+
+
+
+ {/if} + + {#if error} +
+
+
+ +
+ HTTP Ping Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

Understanding HTTP Ping

+
+
+
+
+

HTTP vs ICMP Ping

+
    +
  • HTTP: Tests application layer connectivity
  • +
  • ICMP: Tests network layer connectivity
  • +
  • HTTP ping better reflects real user experience
  • +
  • Works through firewalls that block ICMP
  • +
+
+ +
+

Request Methods

+
    +
  • HEAD: Headers only, fastest and most efficient
  • +
  • GET: Full response, more realistic timing
  • +
  • OPTIONS: Check allowed methods and CORS
  • +
+
+ +
+

Latency Guidelines

+
    +
  • < 100ms: Excellent response time
  • +
  • 100-300ms: Good for most applications
  • +
  • 300-1000ms: Acceptable but noticeable
  • +
  • > 1000ms: Poor, may impact user experience
  • +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/network/tcp-port-check/+page.svelte b/src/routes/diagnostics/network/tcp-port-check/+page.svelte new file mode 100644 index 0000000..2ff50a6 --- /dev/null +++ b/src/routes/diagnostics/network/tcp-port-check/+page.svelte @@ -0,0 +1,549 @@ + + +
+
+

TCP Port Checker

+

Test TCP connectivity to one or more host:port combinations. Attempts direct TCP connections to check if ports are open and measures connection latency.

+
+ + +
+
+ + +

Port Check Examples

+
+
+ {#each examples as example, i} + + {/each} +
+
+
+ + +
+
+

Port Check Configuration

+
+
+
+
+ +
+
+ + +
+
+ +
+ {#each commonPorts as port} + + {/each} +
+
+
+ +
+
+ +
+
+ +
+ +
+
+
+ + + {#if results} +
+
+

Port Check Results

+ +
+
+ + +
+
+ +
+ {results.summary.open} Open +

Ports accepting connections

+
+
+
+ +
+ {results.summary.closed} Closed +

Ports not responding

+
+
+ {#if results.summary.avgLatency} +
+ +
+ {results.summary.avgLatency}ms +

Average latency

+
+
+ {/if} +
+ + +
+

Port Status ({results.results.length} targets)

+
+ {#each results.results as result} + {@const status = getPortStatus(result)} +
+
+
+ + {result.host}:{result.port} +
+ {status.text} +
+ {#if result.error && !result.open} +
+ {result.error} +
+ {/if} +
+ {/each} +
+
+
+
+ {/if} + + {#if error} +
+
+
+ +
+ Port Check Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

Understanding TCP Port Connectivity

+
+
+
+
+

Port States

+
    +
  • Open: Port accepts connections and responds
  • +
  • Closed: Port actively refuses connections
  • +
  • Filtered: Port blocked by firewall (appears as timeout)
  • +
  • Timeout: No response within timeout period
  • +
+
+ +
+

Common Ports

+
    +
  • SSH (22): Secure remote access
  • +
  • HTTP (80): Web traffic
  • +
  • HTTPS (443): Secure web traffic
  • +
  • SMTP (25/587): Email sending
  • +
+
+ +
+

Troubleshooting Tips

+
    +
  • Timeouts often indicate firewall blocking
  • +
  • Connection refused means service is not running
  • +
  • Check both client and server firewalls
  • +
  • Verify service is listening on expected port
  • +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/tls/alpn/+page.svelte b/src/routes/diagnostics/tls/alpn/+page.svelte new file mode 100644 index 0000000..7d1b346 --- /dev/null +++ b/src/routes/diagnostics/tls/alpn/+page.svelte @@ -0,0 +1,623 @@ + + +
+
+

TLS ALPN Negotiation

+

Test Application-Layer Protocol Negotiation (ALPN) to see which protocol a server selects from your offered list. Commonly used to negotiate HTTP/2, HTTP/3, or other application protocols during TLS handshake.

+
+ + +
+
+ + +

ALPN Examples

+
+
+ {#each examples as example, i} + + {/each} +
+
+
+ + +
+
+

ALPN Negotiation Configuration

+
+
+
+
+ +
+
+ + +
+
+ +
+ Quick select: + {#each commonProtocols as preset} + + {/each} +
+
+
+ +
+
+ + {#if useCustomServername} + { clearExampleSelection(); if (isInputValid) probeALPN(); }} + /> + {/if} +
+
+ +
+ +
+
+
+ + + {#if results} +
+
+

ALPN Negotiation Results

+ +
+
+ + + {#if results} + {@const status = getNegotiationStatus()} +
+
+ +
+ Negotiation: {status.status} +

{status.description}

+
+
+ {#if results.tlsVersion} +
+ +
+ TLS Version: {results.tlsVersion} +

Connection established successfully

+
+
+ {/if} +
+ {/if} + + +
+

Protocol Negotiation Details

+ +
+
+
Requested Protocols
+
+ {#each results.requestedProtocols as protocol, i} + {@const protocolInfo = getProtocolInfo(protocol)} +
+
+ {protocolInfo.name} + ({protocol}) + Priority {i + 1} +
+

{protocolInfo.description}

+
+ {/each} +
+
+ + {#if results.negotiatedProtocol} + {@const selectedProtocol = getProtocolInfo(results.negotiatedProtocol)} +
+
Selected Protocol
+
+
+
+ + {selectedProtocol.name} + ({results.negotiatedProtocol}) +
+

{selectedProtocol.description}

+
+
+
+ {:else} +
+
Selected Protocol
+
+ + No protocol was selected by the server +
+
+ {/if} +
+
+ + + {#if results.servername || results.tlsVersion} +
+

Connection Information

+
+
+ Server Name: + {results.servername} +
+ {#if results.tlsVersion} +
+ TLS Version: + {results.tlsVersion} +
+ {/if} +
+
+ {/if} +
+
+ {/if} + + {#if error} +
+
+
+ +
+ ALPN Negotiation Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

Understanding ALPN

+
+
+
+
+

What is ALPN?

+

Application-Layer Protocol Negotiation (ALPN) is a TLS extension that allows the client and server to negotiate which application protocol to use during the TLS handshake.

+
+ +
+

Common Protocols

+
    +
  • h2: HTTP/2 - Binary, multiplexed protocol
  • +
  • h3: HTTP/3 - Latest HTTP over QUIC
  • +
  • http/1.1: Traditional HTTP/1.1
  • +
  • spdy/3.1: Legacy SPDY protocol
  • +
+
+ +
+

Protocol Priority

+

Protocols are offered in preference order. The server selects the first protocol from your list that it supports. Order matters!

+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/tls/certificate/+page.svelte b/src/routes/diagnostics/tls/certificate/+page.svelte new file mode 100644 index 0000000..e4b920a --- /dev/null +++ b/src/routes/diagnostics/tls/certificate/+page.svelte @@ -0,0 +1,503 @@ + + +
+
+

TLS Certificate Analyzer

+

Analyze TLS certificates, view certificate chains, check expiration dates, and examine Subject Alternative Names (SANs). Supports custom SNI servername for multi-domain certificates.

+
+ + +
+
+ + +

Certificate Examples

+
+
+ {#each examples as example, i} + + {/each} +
+
+
+ + +
+
+

Certificate Analysis Configuration

+
+
+
+
+ +
+
+ +
+
+ + {#if useCustomServername} + { clearExampleSelection(); if (isInputValid) analyzeCertificate(); }} + /> + {/if} +
+
+ +
+ +
+
+
+ + + {#if results} +
+
+

Certificate Analysis Results

+ +
+
+ + + {#if results.peerCertificate} + {@const cert = results.peerCertificate} + {@const expiryStatus = getExpiryStatus(cert)} + +
+
+
+ + {expiryStatus.status} +
+
+ + {cert.isNotYetValid ? 'Not yet valid' : 'Currently valid'} +
+
+ + +
+
+

Certificate Information

+
+
+ Common Name: + {cert.subject.CN} +
+
+ Organization: + {cert.subject.O || 'N/A'} +
+
+ Issuer: + {cert.issuer.CN} +
+
+ Serial Number: + {cert.serialNumber} +
+
+ Valid From: + {new Date(cert.validFrom).toLocaleString()} +
+
+ Valid To: + {new Date(cert.validTo).toLocaleString()} +
+
+
+ + + {#if cert.subjectAltNames?.length > 0} +
+

Subject Alternative Names

+
+ {#each cert.subjectAltNames as san} + {san} + {/each} +
+
+ {/if} + + +
+

Fingerprints

+
+
+ SHA1: + {cert.fingerprint} +
+
+ SHA256: + {cert.fingerprint256} +
+
+
+
+
+ {/if} + + + {#if results.chain?.length > 0} +
+

Certificate Chain ({results.chain.length} certificates)

+
+ {#each results.chain as chainCert, i} +
+
+ Level {i} + {chainCert.subject.CN} +
+
+ Issuer: {chainCert.issuer.CN} + Expires: {new Date(chainCert.validTo).toLocaleDateString()} +
+
+ {/each} +
+
+ {/if} + + + {#if results.protocol || results.cipher || results.alpnProtocol} +
+

Connection Details

+
+ {#if results.protocol} +
+ TLS Version: + {results.protocol} +
+ {/if} + {#if results.cipher} +
+ Cipher Suite: + {results.cipher.name} +
+ {/if} + {#if results.alpnProtocol} +
+ ALPN Protocol: + {results.alpnProtocol} +
+ {/if} +
+
+ {/if} +
+
+ {/if} + + {#if error} +
+
+
+ +
+ Certificate Analysis Failed +

{error}

+
+
+
+
+ {/if} +
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/tls/versions/+page.svelte b/src/routes/diagnostics/tls/versions/+page.svelte new file mode 100644 index 0000000..96e2076 --- /dev/null +++ b/src/routes/diagnostics/tls/versions/+page.svelte @@ -0,0 +1,544 @@ + + +
+
+

TLS Versions Probe

+

Test which TLS protocol versions a server supports by attempting connections with different TLS version constraints. Identify deprecated versions and assess overall TLS security posture.

+
+ + +
+
+ + +

TLS Version Examples

+
+
+ {#each examples as example, i} + + {/each} +
+
+
+ + +
+
+

TLS Versions Probe Configuration

+
+
+
+
+ +
+
+ +
+
+ + {#if useCustomServername} + { clearExampleSelection(); if (isInputValid) probeTLSVersions(); }} + /> + {/if} +
+
+ +
+ +
+
+
+ + + {#if results} +
+
+

TLS Versions Probe Results

+ +
+
+ + + {#if results.supported} + {@const security = getOverallSecurity()} + +
+
+
+ +
+ Security Level: {security.level} +

{security.description}

+
+
+
+ +
+ {results.totalSupported} Versions Supported +

Out of {tlsVersions.length} tested

+
+
+
+
+ + +
+

TLS Version Support

+
+ {#each tlsVersions as tlsVer} + {@const supported = results.supported[tlsVer.version]} + {@const status = getVersionStatus(tlsVer.version, supported, tlsVer.deprecated)} + +
+
+
+ +
+ {tlsVer.name} + ({tlsVer.version}) +
+
+ {status.status} +
+ + {#if !supported && results.errors[tlsVer.version]} +
+ {results.errors[tlsVer.version]} +
+ {/if} + + {#if tlsVer.deprecated} +
+ + This version is deprecated and should not be used +
+ {/if} +
+ {/each} +
+
+ + + {#if results.minVersion || results.maxVersion} +
+

Supported Version Range

+
+
+ Minimum Version: + {results.minVersion || 'Unknown'} +
+
+ Maximum Version: + {results.maxVersion || 'Unknown'} +
+
+
+ {/if} + {/if} +
+
+ {/if} + + {#if error} +
+
+
+ +
+ TLS Versions Probe Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

Understanding TLS Versions

+
+
+
+
+

TLS Version Security

+
    +
  • TLS 1.3: Latest version with improved security and performance
  • +
  • TLS 1.2: Widely supported, secure when properly configured
  • +
  • TLS 1.1: Deprecated, should not be used
  • +
  • TLS 1.0: Deprecated, contains security vulnerabilities
  • +
+
+ +
+

Best Practices

+
    +
  • Enable TLS 1.2 and 1.3 only
  • +
  • Disable deprecated versions (TLS 1.0, 1.1)
  • +
  • Regularly update TLS implementations
  • +
  • Use strong cipher suites
  • +
+
+ +
+

Compliance Requirements

+

Many compliance standards (PCI DSS, HIPAA) require disabling deprecated TLS versions. Check your specific requirements.

+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/styles/diagnostics-pages.scss b/src/styles/diagnostics-pages.scss index a8f11e6..0420a92 100644 --- a/src/styles/diagnostics-pages.scss +++ b/src/styles/diagnostics-pages.scss @@ -242,15 +242,22 @@ gap: var(--spacing-sm); } +.record-section { + margin: var(--spacing-md) 0; + h4 { + margin: 0 0 var(--spacing-md) 0; + color: var(--color-primary); + } +} + .record-item { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-md); - background: var(--bg-secondary); + background: var(--bg-primary); border-radius: var(--radius-md); border: 1px solid var(--border-primary); - @media (max-width: 768px) { flex-direction: column; align-items: flex-start;