From c53708b8f43cb75d1eaec552e8bce119c8f223e0 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 6 Oct 2025 04:59:29 +0100 Subject: [PATCH 1/6] Adds new tools for HTTP compression checks and HTTP cookie security --- src/lib/components/global/Icon.svelte | 6 +- src/lib/constants/icon-map.ts | 3 + src/lib/constants/nav.ts | 14 + .../api/internal/diagnostics/http/+server.ts | 373 +++++++++ .../diagnostics/http/compression/+page.svelte | 490 ++++++++++++ .../http/cookie-security/+page.svelte | 737 ++++++++++++++++++ tests/api/utils/api-test-helpers.ts | 8 +- 7 files changed, 1628 insertions(+), 3 deletions(-) create mode 100644 src/routes/diagnostics/http/compression/+page.svelte create mode 100644 src/routes/diagnostics/http/cookie-security/+page.svelte diff --git a/src/lib/components/global/Icon.svelte b/src/lib/components/global/Icon.svelte index 9d7a749..ee92417 100644 --- a/src/lib/components/global/Icon.svelte +++ b/src/lib/components/global/Icon.svelte @@ -25,7 +25,11 @@ * @returns The SVG content string or undefined if not found */ function getSvgContent(iconName: string): string | undefined { - return iconMap[iconName]; + const icon = iconMap[iconName]; + if (!icon) { + console.warn(`Icon "${iconName}" not found. Using default icon.`); + } + return icon; } // Get the SVG content for the current icon (reactive to name changes) diff --git a/src/lib/constants/icon-map.ts b/src/lib/constants/icon-map.ts index cdfa52d..5352729 100644 --- a/src/lib/constants/icon-map.ts +++ b/src/lib/constants/icon-map.ts @@ -236,5 +236,8 @@ export const iconMap: Record = { 'spf-flatten': ``, 'ocsp-stapling': ``, 'tls-cipher-presets': ``, + cookie: ``, + archive: ``, + compress: ``, // '': ``, }; diff --git a/src/lib/constants/nav.ts b/src/lib/constants/nav.ts index f90dfa2..87e2abc 100644 --- a/src/lib/constants/nav.ts +++ b/src/lib/constants/nav.ts @@ -1214,6 +1214,20 @@ export const SUB_NAV: Record = { icon: 'http-perf', keywords: ['http', 'performance', 'timing', 'dns', 'tcp', 'tls', 'ttfb', 'metrics', 'analyzer'], }, + { + href: makePath('/diagnostics/http/compression'), + label: 'HTTP Compression Check', + description: 'Test gzip, brotli, and deflate compression support and measure size differences', + icon: 'archive', + keywords: ['http', 'compression', 'gzip', 'brotli', 'deflate', 'size', 'reduction', 'performance'], + }, + { + href: makePath('/diagnostics/http/cookie-security'), + label: 'Cookie Security Inspector', + description: 'Inspect Set-Cookie headers for Secure, HttpOnly, SameSite, and other security attributes', + icon: 'cookie', + keywords: ['http', 'cookie', 'security', 'secure', 'httponly', 'samesite', 'csrf', 'xss', 'attributes'], + }, ], }, { diff --git a/src/routes/api/internal/diagnostics/http/+server.ts b/src/routes/api/internal/diagnostics/http/+server.ts index b236bb8..0ac3a2e 100644 --- a/src/routes/api/internal/diagnostics/http/+server.ts +++ b/src/routes/api/internal/diagnostics/http/+server.ts @@ -263,6 +263,204 @@ function analyzeSecurityHeaders(headers: Headers): { return { headers: securityHeaders, analysis }; } +function parseCookie(cookieHeader: string): { + name: string; + value: string; + domain?: string; + path?: string; + expires?: string; + maxAge?: number; + secure?: boolean; + httpOnly?: boolean; + sameSite?: string; +} { + const parts = cookieHeader.split(';').map((part) => part.trim()); + const [nameValue] = parts; + const [name, value] = nameValue.split('=', 2); + + const cookie = { + name: name?.trim() || '', + value: value?.trim() || '', + }; + + const attributes: any = {}; + + for (let i = 1; i < parts.length; i++) { + const part = parts[i]; + const [attrName, attrValue] = part.split('=', 2); + const attr = attrName.toLowerCase().trim(); + + switch (attr) { + case 'domain': + attributes.domain = attrValue?.trim(); + break; + case 'path': + attributes.path = attrValue?.trim(); + break; + case 'expires': + attributes.expires = attrValue?.trim(); + break; + case 'max-age': + attributes.maxAge = parseInt(attrValue?.trim() || '0'); + break; + case 'secure': + attributes.secure = true; + break; + case 'httponly': + attributes.httpOnly = true; + break; + case 'samesite': + attributes.sameSite = attrValue?.trim() || 'None'; + break; + } + } + + return { ...cookie, ...attributes }; +} + +function analyzeCookieSecurity(cookie: any): any { + const issues = []; + let score = 100; + let securityLevel = 'secure'; + + // Check cookie name for sensitive patterns + const sensitiveName = /session|auth|token|login|csrf|jwt|api[-_]?key|sid|ssid/i.test(cookie.name); + const analyticsCookie = /_ga|_gid|_utm|analytics|tracking|fbp|fbc|cfm|optimizely/i.test(cookie.name); + + // Check Secure flag + if (!cookie.secure) { + issues.push('Missing Secure flag - cookie can be sent over unencrypted connections'); + score -= 30; + securityLevel = 'error'; + } + + // Check HttpOnly flag (more important for auth cookies) + if (!cookie.httpOnly) { + if (sensitiveName) { + issues.push('Missing HttpOnly on sensitive cookie - vulnerable to XSS attacks'); + score -= 25; + securityLevel = 'error'; + } else if (!analyticsCookie) { + issues.push('Missing HttpOnly flag - cookie accessible via JavaScript'); + score -= 10; + if (securityLevel === 'secure') securityLevel = 'warning'; + } + // Analytics cookies legitimately need JavaScript access + } + + // Check SameSite attribute + const sameSite = cookie.sameSite?.toLowerCase(); + if (!sameSite || sameSite === 'none') { + if (sensitiveName) { + issues.push('Missing or weak SameSite on sensitive cookie - vulnerable to CSRF'); + score -= 25; + securityLevel = 'error'; + } else { + issues.push('Missing or weak SameSite attribute - potential CSRF risk'); + score -= 15; + if (securityLevel === 'secure') securityLevel = 'warning'; + } + } else if (sameSite === 'lax') { + if (sensitiveName) { + issues.push('SameSite=Lax on sensitive cookie - consider Strict for better protection'); + score -= 10; + if (securityLevel === 'secure') securityLevel = 'warning'; + } else { + score -= 5; // Minor deduction for non-sensitive cookies + } + } + + // Check for overly broad domain (less critical for analytics) + if (cookie.domain && cookie.domain.startsWith('.')) { + if (sensitiveName) { + issues.push('Wildcard domain on sensitive cookie - may expose to subdomains'); + score -= 10; + if (securityLevel === 'secure') securityLevel = 'warning'; + } else if (!analyticsCookie) { + issues.push('Wildcard domain may expose cookie to subdomains unnecessarily'); + score -= 5; + } + // Analytics cookies often need wildcard domains + } + + // Check for missing expiration + if (!cookie.expires && !cookie.maxAge) { + if (sensitiveName) { + // Session cookies can be good for auth + issues.push('Session cookie - will be cleared when browser closes'); + } else { + issues.push('No expiration set - cookie will persist as session cookie'); + score -= 3; + } + } + + return { + ...cookie, + score: Math.max(0, score), + securityLevel, + issues: issues.length > 0 ? issues : undefined, + }; +} + +function generateCookieRecommendations(cookies: any[]): any[] { + const recommendations = []; + const hasInsecure = cookies.some((c) => !c.secure); + const hasNoHttpOnly = cookies.some((c) => !c.httpOnly); + const hasWeakSameSite = cookies.some((c) => !c.sameSite || ['none', 'lax'].includes(c.sameSite?.toLowerCase())); + + if (hasInsecure) { + recommendations.push({ + title: 'Add Secure Flag', + description: 'Always set the Secure flag for cookies to prevent transmission over unencrypted connections.', + example: 'Set-Cookie: sessionid=abc123; Secure; HttpOnly; SameSite=Strict', + }); + } + + if (hasNoHttpOnly) { + recommendations.push({ + title: 'Add HttpOnly Flag', + description: 'Set HttpOnly to prevent client-side scripts from accessing sensitive cookies.', + example: 'Set-Cookie: token=xyz789; Secure; HttpOnly; SameSite=Strict', + }); + } + + if (hasWeakSameSite) { + recommendations.push({ + title: 'Strengthen SameSite Policy', + description: + 'Use SameSite=Strict for sensitive cookies to prevent CSRF attacks. Use Lax for less sensitive cookies that need cross-site functionality.', + example: 'Set-Cookie: auth=token123; Secure; HttpOnly; SameSite=Strict', + }); + } + + if (cookies.length === 0) { + recommendations.push({ + title: 'No Cookies Detected', + description: 'This server does not set any cookies, which may be intentional for stateless applications.', + }); + } + + return recommendations; +} + +function generateSecuritySummary(score: number | null, cookieCount: number): string { + if (cookieCount === 0) { + return 'No cookies detected in response headers. This may be intentional for stateless applications.'; + } + + if (score === null || score >= 90) { + return 'Excellent cookie security! All security best practices are followed.'; + } else if (score >= 80) { + return 'Good cookie security with minor improvements possible.'; + } else if (score >= 70) { + return 'Moderate cookie security - some important flags may be missing.'; + } else if (score >= 60) { + return 'Poor cookie security - multiple security issues detected.'; + } else { + return 'Critical cookie security issues - immediate attention required.'; + } +} + export const POST: RequestHandler = async ({ request }) => { try { const { @@ -427,6 +625,181 @@ export const POST: RequestHandler = async ({ request }) => { }); } + case 'compression': { + const compressionEncodings = ['gzip', 'br', 'deflate']; + const results = []; + + // Get uncompressed version first + const startTime = performance.now(); + const { response: uncompressedResponse, timings: uncompressedTimings } = await performHTTPRequest( + url, + 'GET', + { 'Accept-Encoding': 'identity' }, + true, + maxRedirects, + timeout, + ); + + const uncompressedBody = await uncompressedResponse.text(); + const uncompressedSize = new TextEncoder().encode(uncompressedBody).length; + + // Test each compression method + for (const encoding of compressionEncodings) { + try { + const testStartTime = performance.now(); + const { response: compressedResponse } = await performHTTPRequest( + url, + 'GET', + { 'Accept-Encoding': encoding }, + true, + maxRedirects, + timeout, + ); + const testEndTime = performance.now(); + + const actualEncoding = compressedResponse.headers.get('content-encoding'); + const contentLength = compressedResponse.headers.get('content-length'); + + const supported = actualEncoding?.includes(encoding) || false; + let compressedSize = uncompressedSize; + + if (supported && contentLength) { + compressedSize = parseInt(contentLength); + } else if (supported) { + // If no content-length, get the actual body size + const compressedBody = await compressedResponse.text(); + compressedSize = new TextEncoder().encode(compressedBody).length; + } + + const ratio = uncompressedSize > 0 ? ((uncompressedSize - compressedSize) / uncompressedSize) * 100 : 0; + + results.push({ + encoding, + supported, + compressedSize, + ratio, + responseTime: Math.round(testEndTime - testStartTime), + actualEncoding: actualEncoding || 'none', + }); + } catch (err) { + results.push({ + encoding, + supported: false, + compressedSize: uncompressedSize, + ratio: 0, + responseTime: 0, + error: (err as Error).message, + }); + } + } + + // Find best compression + const supportedResults = results.filter((r) => r.supported && r.ratio > 0); + const bestCompression = + supportedResults.length > 0 + ? supportedResults.reduce((best, current) => (current.ratio > best.ratio ? current : best)) + : { encoding: 'none', ratio: 0 }; + + // Check what the server naturally uses + const { response: naturalResponse } = await performHTTPRequest(url, 'GET', {}, true, maxRedirects, timeout); + const serverEncoding = naturalResponse.headers.get('content-encoding'); + + const responseHeaders: Record = {}; + naturalResponse.headers.forEach((value, key) => { + responseHeaders[key.toLowerCase()] = value; + }); + + const totalTime = performance.now() - startTime; + + return json({ + url: naturalResponse.url, + uncompressed: { + size: uncompressedSize, + }, + serverCompression: { + enabled: !!serverEncoding, + encoding: serverEncoding || 'none', + }, + compressionResults: results, + bestCompression, + headers: responseHeaders, + timings: { + ...uncompressedTimings, + total: Math.round(totalTime), + }, + }); + } + + case 'cookie-security': { + const { response, timings } = await performHTTPRequest(url, method, customHeaders, true, maxRedirects, timeout); + + // Parse all Set-Cookie headers + const setCookieHeaders: string[] = []; + response.headers.forEach((value, key) => { + if (key.toLowerCase() === 'set-cookie') { + // Handle multiple Set-Cookie headers (some servers send multiple with same name) + if (Array.isArray(value)) { + setCookieHeaders.push(...value); + } else { + setCookieHeaders.push(value); + } + } + }); + + const cookies = []; + let totalSecurityScore = 0; + let secureCookies = 0; + let httpOnlyCookies = 0; + + const seenCookies = new Set(); + + for (let i = 0; i < setCookieHeaders.length; i++) { + const cookieHeader = setCookieHeaders[i]; + const cookie = parseCookie(cookieHeader); + + // Skip empty cookie names or deletion cookies + if ( + !cookie.name || + (cookie.expires && new Date(cookie.expires).getTime() < Date.now()) || + (cookie.maxAge !== undefined && cookie.maxAge <= 0) + ) { + continue; + } + + // Skip duplicate cookie names (keep only the first/latest) + const cookieKey = `${cookie.name}_${cookie.domain || ''}_${cookie.path || '/'}`; + if (seenCookies.has(cookieKey)) { + continue; + } + seenCookies.add(cookieKey); + + const analysis = analyzeCookieSecurity(cookie); + // Add unique identifier to prevent key conflicts + analysis.id = `${cookie.name}_${i}`; + cookies.push(analysis); + totalSecurityScore += analysis.score; + if (analysis.secure) secureCookies++; + if (analysis.httpOnly) httpOnlyCookies++; + } + + const averageScore = cookies.length > 0 ? Math.round(totalSecurityScore / cookies.length) : null; + const recommendations = generateCookieRecommendations(cookies); + const summary = generateSecuritySummary(averageScore, cookies.length); + + return json({ + url: response.url, + status: response.status, + totalCookies: cookies.length, + secureCookies, + httpOnlyCookies, + securityScore: averageScore, + summary, + cookies, + recommendations, + timings, + }); + } + default: throw error(400, `Unknown action: ${action}`); } diff --git a/src/routes/diagnostics/http/compression/+page.svelte b/src/routes/diagnostics/http/compression/+page.svelte new file mode 100644 index 0000000..fd8071d --- /dev/null +++ b/src/routes/diagnostics/http/compression/+page.svelte @@ -0,0 +1,490 @@ + + +
+
+

HTTP Compression Check

+

Test gzip, brotli, and deflate compression support and measure size differences

+
+ + +
+
+ + +

Quick Examples

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

URL to Test

+
+
+
+ +
+ clearExampleSelection()} + onkeydown={(e) => e.key === 'Enter' && checkCompression()} + /> + +
+
+
+
+ + {#if error} +
+
+
+ +
+ Compression Test Failed +

{error}

+
+
+
+
+ {/if} + + {#if loading} +
+
+
+ +
+

Testing Compression

+

Checking support for gzip, brotli, and deflate compression...

+
+
+
+
+ {/if} + + {#if results} +
+
+

Compression Results

+
+
+ +
+
+

Overview

+
+
+
+
+
Server Compression
+
+ + {results.serverCompression.enabled ? 'Enabled' : 'Disabled'} +
+ {#if results.serverCompression.encoding} +
{results.serverCompression.encoding}
+ {/if} +
+ +
+
Best Compression
+
+ + {results.bestCompression.encoding} +
+
{results.bestCompression.ratio.toFixed(1)}% reduction
+
+ +
+
Uncompressed Size
+
{formatBytes(results.uncompressed.size)}
+
+ +
+
Time Taken
+
{results.timings.total}ms
+
+
+
+
+ + +
+
+

Compression Methods

+
+
+
+ {#each results.compressionResults as result (result.encoding)} +
+
+
+ + {result.encoding} +
+
+ + {result.supported ? 'Supported' : 'Not Supported'} +
+
+ + {#if result.supported} +
+
+
+
+
+
+
+ {formatBytes(results.uncompressed.size)} + {formatBytes(result.compressedSize)} +
+
+ +
+
+ Reduction: + {result.ratio.toFixed(1)}% +
+
+ Time: + {result.responseTime}ms +
+
+
+ {/if} +
+ {/each} +
+
+
+ + +
+
+

Response Headers

+
+
+
+ {#each Object.entries(results.headers) as [key, value] (key)} +
+ {key} + {value} +
+ {/each} +
+
+
+
+
+ {/if} +
+ + diff --git a/src/routes/diagnostics/http/cookie-security/+page.svelte b/src/routes/diagnostics/http/cookie-security/+page.svelte new file mode 100644 index 0000000..4f962c3 --- /dev/null +++ b/src/routes/diagnostics/http/cookie-security/+page.svelte @@ -0,0 +1,737 @@ + + +
+
+

HTTP Cookie Security Inspector

+

Analyze Set-Cookie headers for Secure, HttpOnly, SameSite, and other security attributes

+
+ + +
+
+ + +

Quick Examples

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

URL to Inspect

+
+
+
+ +
+ clearExampleSelection()} + onkeydown={(e) => e.key === 'Enter' && checkCookieSecurity()} + /> + +
+
+
+
+ + {#if error} +
+
+
+ +
+ Cookie Inspection Failed +

{error}

+
+
+
+
+ {/if} + + {#if loading} +
+
+
+ +
+

Analyzing Cookies

+

Inspecting Set-Cookie headers for security attributes...

+
+
+
+
+ {/if} + + {#if results} +
+
+

Cookie Security Analysis

+
+
+ +
+
+

Security Score

+
+
+
+
+
{getSecurityGrade(results.securityScore).grade}
+
+ {results.securityScore !== null ? `${results.securityScore}/100` : 'No cookies'} +
+
+
+

Overall Assessment

+

{results.summary}

+
+
+ Total Cookies: + {results.totalCookies} +
+
+ Secure Cookies: + {results.secureCookies} +
+
+ HttpOnly Cookies: + {results.httpOnlyCookies} +
+
+
+
+
+
+ + + {#if results.cookies && results.cookies.length > 0} +
+
+

Cookie Details

+
+
+
+ {#each results.cookies as cookie (cookie.id || cookie.name)} + + {/each} +
+
+
+ {:else} +
+
+
+ +

No Cookies Found

+

The server did not send any Set-Cookie headers in the response.

+
+
+
+ {/if} + + + {#if results.recommendations && results.recommendations.length > 0} +
+
+

Security Recommendations

+
+
+
+ {#each results.recommendations as recommendation, index (index)} +
+ +
+

{recommendation.title}

+

{recommendation.description}

+ {#if recommendation.example} + {recommendation.example} + {/if} +
+
+ {/each} +
+
+
+ {/if} +
+
+ {/if} +
+ + diff --git a/tests/api/utils/api-test-helpers.ts b/tests/api/utils/api-test-helpers.ts index 479594d..d10871b 100644 --- a/tests/api/utils/api-test-helpers.ts +++ b/tests/api/utils/api-test-helpers.ts @@ -3,7 +3,11 @@ * Common helpers for testing API endpoints against Swagger specification */ -export const API_BASE_URL = 'http://localhost:4175'; +// @ts-ignore-next +export const PORT = process.env.PORT || '4175'; +export const HOST = 'localhost'; +export const PROTO = 'http://'; +export const API_BASE_URL = `${PROTO}${HOST}:${PORT}`; /** * Convert IP object to dotted decimal notation @@ -218,4 +222,4 @@ export class TestReporter { return this.failed === 0; } -} \ No newline at end of file +} From dc9006da63e9ca442c68ef5d8b64635a3c5b81e1 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 6 Oct 2025 07:01:21 +0100 Subject: [PATCH 2/6] Fixes and improvments to nav, card collection and sitemap page --- src/lib/components/furniture/TopNav.svelte | 37 ++++++++++++---------- src/lib/components/global/ToolsGrid.svelte | 5 ++- src/lib/constants/icon-map.ts | 9 ++++++ src/lib/constants/nav.ts | 13 ++++++-- src/routes/sitemap/+page.svelte | 15 ++++++++- 5 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/lib/components/furniture/TopNav.svelte b/src/lib/components/furniture/TopNav.svelte index 37d5f9d..0bfb18a 100644 --- a/src/lib/components/furniture/TopNav.svelte +++ b/src/lib/components/furniture/TopNav.svelte @@ -81,22 +81,27 @@ switch ($navbarDisplay) { case 'bookmarked': - items = $bookmarks.map((bookmark) => ({ - href: bookmark.href, - label: bookmark.label, - icon: bookmark.icon, - description: bookmark.description, - })); + items = $bookmarks + .filter((bookmark) => bookmark.label) + .map((bookmark) => ({ + href: bookmark.href, + label: bookmark.label, + icon: bookmark.icon, + description: bookmark.description, + })); // Show most recent bookmarks first return items.reverse(); case 'frequent': - items = $frequentlyUsedTools.slice(0, 8).map((tool) => ({ - href: tool.href, - label: tool.label || 'Untitled Tool', - icon: tool.icon, - description: tool.description, - })); + items = $frequentlyUsedTools + .filter((tool) => tool.label) + .slice(0, 8) + .map((tool) => ({ + href: tool.href, + label: tool.label || 'Untitled Tool', + icon: tool.icon, + description: tool.description, + })); // Already sorted by frequency, no need to reverse return items; @@ -106,7 +111,7 @@ case 'default': default: // Keep default navigation items in their original order - return TOP_NAV; + return TOP_NAV.filter((item) => item.label); } })(); @@ -158,8 +163,8 @@
{#each getSubPages(item.href) as subItem ('href' in subItem ? subItem.href : subItem.title)} - {#if 'href' in subItem} - + {#if 'href' in subItem && subItem.label} +
- {#each subItem.items as groupItem (groupItem.href)} + {#each subItem.items.filter((i) => i.label) as groupItem (groupItem.href)} array.findIndex((t) => t.href === tool.href) === index); + // Also filter out items without a label + $: uniqueTools = tools + .filter((tool) => tool.label) + .filter((tool, index, array) => array.findIndex((t) => t.href === tool.href) === index); {#if uniqueTools.length === 0 && searchQuery} diff --git a/src/lib/constants/icon-map.ts b/src/lib/constants/icon-map.ts index 5352729..e26713a 100644 --- a/src/lib/constants/icon-map.ts +++ b/src/lib/constants/icon-map.ts @@ -239,5 +239,14 @@ export const iconMap: Record = { cookie: ``, archive: ``, compress: ``, + 'ref-common-subnets': ``, + 'ref-network-classes': ``, + 'ref-reserved-ranges': ``, + 'terminal': ``, + 'file-x': ``, + 'folder': ``, + 'package': ``, + 'tag': ``, + 'monitor': ``, // '': ``, }; diff --git a/src/lib/constants/nav.ts b/src/lib/constants/nav.ts index 87e2abc..638f7cf 100644 --- a/src/lib/constants/nav.ts +++ b/src/lib/constants/nav.ts @@ -1271,6 +1271,13 @@ export const SUB_NAV: Record = { icon: 'tls-cipher-presets', keywords: ['tls', 'cipher', 'presets', 'modern', 'intermediate', 'legacy', 'security', 'suites', 'probe'], }, + { + href: makePath('/diagnostics/tls/banner'), + label: 'Service Banner Grabber', + description: 'Retrieve service banners from SSH, SMTP, HTTP, FTP, and other network services', + icon: 'terminal', + keywords: ['banner', 'service', 'ssh', 'smtp', 'ftp', 'http', 'telnet', 'fingerprinting', 'reconnaissance'], + }, ], }, { @@ -1903,10 +1910,10 @@ function extractAllNavItems(navStructure: (NavItem | NavGroup)[]): NavItem[] { for (const item of navStructure) { if ('items' in item) { - // It's a NavGroup (might have href too, but we only want its items) - items.push(...item.items); + // It's a NavGroup - recursively extract items from its children + items.push(...extractAllNavItems(item.items)); } else if ('href' in item && 'label' in item) { - // It's a NavItem (has href and label) + // It's a NavItem (has href and label, but no items) items.push(item as NavItem); } } diff --git a/src/routes/sitemap/+page.svelte b/src/routes/sitemap/+page.svelte index e94ed51..1c9ec20 100644 --- a/src/routes/sitemap/+page.svelte +++ b/src/routes/sitemap/+page.svelte @@ -1,11 +1,13 @@ + +
+
+

Service Banner Grabber

+

Retrieve service banners from SSH, SMTP, HTTP, FTP, and other network services

+
+ + +
+
+ + +

Quick Examples

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

Target Service

+
+
+
+
+ + +
+
+ +
+
+ + clearExampleSelection()} + onkeydown={(e) => e.key === 'Enter' && grabBanner()} + /> +
+
+ + clearExampleSelection()} + onkeydown={(e) => e.key === 'Enter' && grabBanner()} + /> +
+
+ + +
+
+ + {#if error} +
+
+
+ +
+ Connection Failed +

{error}

+
+
+
+
+ {/if} + + {#if loading} +
+
+
+ +
+

Grabbing Banner

+

Connecting to {host}:{port}...

+
+
+
+
+ {/if} + + {#if results} +
+
+

Banner Information

+
+
+ +
+
+

Connection Details

+
+
+
+
+ Host: + {results.host} +
+
+ Port: + {results.port} +
+
+ Protocol: + + + {results.protocol || 'Unknown'} + +
+
+ Response Time: + {results.responseTime}ms +
+
+
+
+ + + + + + {#if results.analysis && (results.analysis.software || results.analysis.version || results.analysis.os || (results.analysis.security && results.analysis.security.length > 0))} +
+
+

Service Analysis

+
+
+
+ {#if results.analysis.software} +
+ +
+

Software

+

{results.analysis.software}

+
+
+ {/if} + {#if results.analysis.version} +
+ +
+

Version

+

{results.analysis.version}

+
+
+ {/if} + {#if results.analysis.os} +
+ +
+

Operating System

+

{results.analysis.os}

+
+
+ {/if} + {#if results.analysis.security && results.analysis.security.length > 0} +
+ +
+

Security Notes

+
    + {#each results.analysis.security as note, i (i)} +
  • {note}
  • + {/each} +
+
+
+ {/if} +
+
+
+ {/if} + + + {#if results.tls} +
+
+

TLS Information

+
+
+
+
+ Protocol: + {results.tls.protocol} +
+
+ Cipher: + {results.tls.cipher} +
+ {#if results.tls.certificate} +
+ Certificate CN: + {results.tls.certificate.cn} +
+ {/if} +
+
+
+ {/if} +
+
+ {/if} +
+ + diff --git a/src/routes/dns/+page.svelte b/src/routes/dns/+page.svelte index 15d17b7..bf5dbf1 100644 --- a/src/routes/dns/+page.svelte +++ b/src/routes/dns/+page.svelte @@ -4,14 +4,16 @@ import type { NavItem, NavGroup } from '$lib/constants/nav'; import '../../styles/pages.scss'; - // Extract tools for DNS section + // Extract tools for DNS section (excluding category headers with title) function extractNavItems(items: (NavItem | NavGroup)[]): NavItem[] { const navItems: NavItem[] = []; for (const item of items) { - if ('href' in item) { - navItems.push(item); - } else if ('title' in item && 'items' in item) { - navItems.push(...item.items); + if ('items' in item) { + // It's a category - extract its children recursively + navItems.push(...extractNavItems(item.items)); + } else if ('href' in item && 'label' in item && !('title' in item)) { + // It's a tool (has href and label but no title) + navItems.push(item as NavItem); } } return navItems; From de5535190fc36cd1814098e92e8b69e186db4255 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 6 Oct 2025 19:20:45 +0100 Subject: [PATCH 4/6] Updates about docs --- .../page-specific/about/ApiSection.svelte | 6 +- .../about/BuildingSection.svelte | 6 +- .../about/DeployingSection.svelte | 58 +++++++++++++ src/lib/constants/icon-map.ts | 11 +-- src/lib/constants/nav.ts | 82 ++++++++++++------- src/lib/constants/site.ts | 2 + src/routes/+layout.svelte | 10 +++ .../about/(sections)/deploying/+page.svelte | 5 ++ src/routes/about/+page.svelte | 8 +- .../diagnostics/tls/banner/+page.svelte | 30 +++---- src/routes/sitemap/+page.svelte | 4 +- src/styles/page-specific/about-page.scss | 2 +- static/api-docs.html | 2 +- 13 files changed, 168 insertions(+), 58 deletions(-) create mode 100644 src/lib/components/page-specific/about/DeployingSection.svelte create mode 100644 src/routes/about/(sections)/deploying/+page.svelte diff --git a/src/lib/components/page-specific/about/ApiSection.svelte b/src/lib/components/page-specific/about/ApiSection.svelte index c2ee022..5b9f240 100644 --- a/src/lib/components/page-specific/about/ApiSection.svelte +++ b/src/lib/components/page-specific/about/ApiSection.svelte @@ -1,4 +1,8 @@

API

-

Yes, we have an API! It's free to use, doesn't require an API key nor CORS.

+

+ Yes, we have an API! It's free to use, doesn't require an API key nor CORS.
+ Try calling
GET https://networkingtoolbox.net/api, or checkout the + API Docs. +

diff --git a/src/lib/components/page-specific/about/BuildingSection.svelte b/src/lib/components/page-specific/about/BuildingSection.svelte index c043e69..1d8ed4c 100644 --- a/src/lib/components/page-specific/about/BuildingSection.svelte +++ b/src/lib/components/page-specific/about/BuildingSection.svelte @@ -2,7 +2,7 @@
-

Building from Source

+

Building

Prerequisites

Make sure you have Node.js @@ -28,7 +28,7 @@ npm run tsc npm run lint

- +

Contributing

diff --git a/src/lib/components/page-specific/about/DeployingSection.svelte b/src/lib/components/page-specific/about/DeployingSection.svelte new file mode 100644 index 0000000..d170204 --- /dev/null +++ b/src/lib/components/page-specific/about/DeployingSection.svelte @@ -0,0 +1,58 @@ + + +

+

Deploying

+

+ As well as our free hosted version, at networkingtoolbox.net, we've made + it as quick and easy as possible for you to deploy your own instance. Either on your own infrastructure, or using + one of our supported free hosting providers. +

+ +

Option #1 - Docker

+

With Docker installed, just run the following command:

+
+ docker run -p 8080:8080 lissy93/networking-toolbox +
+

+ You can also checkout our docker-compose.yml, using the + lissy93/networking-toolbox image from + DockerHub. +

+ +

Option #2 - Free Hosting Provider

+

+ You can quickly and easily deploy your own instance for free, on any other our supported hosting providers! Just + fork our repository, and then import it into your chosen provider. +

+ +

Alternatively, just click one of the buttons below!

+ +

Option #3 - GitHub Pages

+
    +
  1. Fork the repository (you'll need a free GitHub account)
  2. +
  3. Go to your new repo's Settings → Pages → Source and select the gh-pages branch
  4. +
  5. Then, head to the Actions tab, find the "Deploy to GitHub Pages" workflow, and trigger it
  6. +
  7. Visit https://[your-username].github.io/networking-toolbox/ to see your deployed app
  8. +
+ +

Option #4 - Source

+

+ If you want to make any changes before deploying, or want to host it on any other platform not already covered + above, then you can easily do so, by compiling the app from source. We've dot detailed Building Instructions, or you can check out the docs in the repo. +

+
+ + diff --git a/src/lib/constants/icon-map.ts b/src/lib/constants/icon-map.ts index e26713a..b9b79cc 100644 --- a/src/lib/constants/icon-map.ts +++ b/src/lib/constants/icon-map.ts @@ -242,11 +242,12 @@ export const iconMap: Record = { 'ref-common-subnets': ``, 'ref-network-classes': ``, 'ref-reserved-ranges': ``, - 'terminal': ``, + terminal: ``, 'file-x': ``, - 'folder': ``, - 'package': ``, - 'tag': ``, - 'monitor': ``, + folder: ``, + package: ``, + tag: ``, + monitor: ``, + lost: ``, // '': ``, }; diff --git a/src/lib/constants/nav.ts b/src/lib/constants/nav.ts index 638f7cf..9e1a596 100644 --- a/src/lib/constants/nav.ts +++ b/src/lib/constants/nav.ts @@ -25,13 +25,13 @@ export const STANDALONE_PAGES: NavItem[] = [ { href: makePath('/bookmarks'), label: 'Bookmarks', - description: 'Saved network calculations and frequently used tools', + description: 'Save and organize network calculations and tool results', keywords: ['bookmarks', 'saved', 'favorites', 'shortcuts', 'calculations'], }, { href: makePath('/offline'), label: 'Offline', - description: 'Offline mode and cached calculations', + description: 'Access cached tools and data offline', keywords: ['offline', 'cache', 'no-internet', 'local'], }, ]; @@ -40,7 +40,7 @@ export const TOP_NAV: NavItem[] = [ { href: makePath('/subnetting'), label: 'Subnetting', - description: 'Subnet calculators and network planning tools for IPv4, IPv6, VLSM, and supernetting', + description: 'Subnet calculators for IPv4, IPv6, VLSM, supernetting', keywords: [ 'subnet', 'calculator', @@ -57,12 +57,14 @@ export const TOP_NAV: NavItem[] = [ 'hosts', 'addressing', 'allocation', + 'ip calculator', + 'subnet tool', ], }, { href: makePath('/cidr'), label: 'CIDR', - description: 'CIDR tools and converters for network analysis and optimization', + description: 'CIDR notation tools, converters, and calculators', keywords: [ 'cidr', 'subnet', @@ -84,7 +86,7 @@ export const TOP_NAV: NavItem[] = [ { href: makePath('/ip-address-convertor'), label: 'IP Tools', - description: 'IP address converters, validators, generators, and format transformation tools', + description: 'IP address converters, validators, and generators', keywords: [ 'ip', 'address', @@ -103,12 +105,14 @@ export const TOP_NAV: NavItem[] = [ 'enumerate', 'validation', 'transformation', + 'ip format', + 'address converter', ], }, { href: makePath('/dns'), label: 'DNS Tools', - description: 'DNS record generators, validators, zone tools, and DNSSEC utilities', + description: 'DNS record generators, validators, and DNSSEC tools', keywords: [ 'dns', 'records', @@ -130,12 +134,14 @@ export const TOP_NAV: NavItem[] = [ 'dkim', 'soa', 'ns', + 'nameserver', + 'domain', ], }, { href: makePath('/diagnostics'), label: 'Lookups', - description: 'Network diagnostics, DNS lookups, HTTP analysis, TLS testing, and connectivity checks', + description: 'Network diagnostics and connectivity testing', keywords: [ 'diagnostics', 'lookup', @@ -154,12 +160,14 @@ export const TOP_NAV: NavItem[] = [ 'rdap', 'whois', 'analysis', + 'dns checker', + 'ssl test', ], }, { href: makePath('/reference'), label: 'Ref', - description: 'Networking reference guides, explanations, and quick lookup tables', + description: 'Networking reference guides and lookup tables', keywords: [ 'reference', 'guide', @@ -189,38 +197,57 @@ export const SUB_NAV: Record = { { href: makePath('/subnetting/ipv4-subnet-calculator'), label: 'IPv4 Subnet Calculator', - description: - 'Calculate subnet information, network addresses, broadcast addresses, and host ranges with visual network analysis', + description: 'Calculate subnet masks, network addresses, broadcast addresses, and host ranges', icon: 'subnet-calculator', - keywords: ['subnet', 'calculator', 'ipv4', 'network', 'broadcast', 'hosts', 'cidr', 'netmask'], + keywords: [ + 'subnet', + 'calculator', + 'ipv4', + 'network', + 'broadcast', + 'hosts', + 'cidr', + 'netmask', + 'wildcard', + 'gateway', + 'usable hosts', + ], }, { href: makePath('/subnetting/ipv6-subnet-calculator'), label: 'IPv6 Subnet Calculator', - description: 'Calculate IPv6 subnets with 128-bit addressing and modern network prefix planning', + description: 'Calculate IPv6 subnets and network prefixes', icon: 'ipv6-subnet-calculator', keywords: ['subnet', 'calculator', 'ipv6', 'network', 'prefix', '128-bit', 'addressing'], }, { href: makePath('/subnetting/vlsm-calculator'), label: 'VLSM Calculator', - description: - 'Variable Length Subnet Mask calculator to break networks into multiple smaller subnets with optimal allocation', + description: 'Variable Length Subnet Mask calculator for splitting networks into smaller subnets', icon: 'vlsm-calculator', - keywords: ['vlsm', 'variable', 'length', 'subnet', 'mask', 'calculator', 'subnets', 'allocation'], + keywords: [ + 'vlsm', + 'variable', + 'length', + 'subnet', + 'mask', + 'calculator', + 'subnets', + 'allocation', + 'network design', + ], }, { href: makePath('/subnetting/supernet-calculator'), label: 'Supernet Calculator', - description: - 'Aggregate multiple networks into supernets for route summarization and efficient routing table management', + description: 'Aggregate multiple networks into supernets for route summarization', icon: 'supernet-calculator', keywords: ['supernet', 'calculator', 'aggregate', 'route', 'summarization', 'routing', 'table'], }, { href: makePath('/subnetting/planner'), label: 'Subnet Planner', - description: 'Design VLSM networks with drag-and-drop subnet planning and optimize address allocation strategies', + description: 'Design VLSM networks with drag-and-drop planning', icon: 'subnet-planner', keywords: ['subnet', 'planner', 'design', 'vlsm', 'networks', 'planning', 'allocation'], }, @@ -264,43 +291,42 @@ export const SUB_NAV: Record = { { href: makePath('/cidr/next-available'), label: 'Next Available Subnet', - description: 'Find available subnets from pools minus allocations with first-fit or best-fit policies', + description: 'Find available subnets in pools using first-fit or best-fit algorithms', icon: 'next-available-subnet', keywords: ['next', 'available', 'subnet', 'pools', 'allocations', 'first-fit', 'best-fit'], }, { href: makePath('/cidr/gaps'), label: 'Free Space Finder', - description: 'List all free blocks in pool CIDRs minus allocations, filterable by target prefix length', + description: 'List unallocated IP blocks in CIDR pools by prefix length', icon: 'cidr-gaps', keywords: ['free', 'space', 'gaps', 'finder', 'blocks', 'pools', 'allocations', 'prefix'], }, { href: makePath('/cidr/deaggregate'), label: 'CIDR Deaggregate', - description: 'Decompose CIDR blocks and ranges into uniform target prefix subnets (e.g., break into /24s)', + description: 'Break CIDR blocks into smaller uniform subnets (e.g., split into /24s)', icon: 'cidr-deaggregate', keywords: ['cidr', 'deaggregate', 'decompose', 'break', 'uniform', 'prefix', 'subnets', 'split'], }, { href: makePath('/cidr/compare'), label: 'CIDR Compare', - description: - 'Compare two lists of CIDR blocks to identify added, removed, and unchanged entries after normalization', + description: 'Compare CIDR lists to show added, removed, and unchanged blocks', icon: 'cidr-compare', keywords: ['cidr', 'compare', 'diff', 'audit', 'added', 'removed', 'unchanged', 'normalization'], }, { href: makePath('/cidr/allocator'), label: 'CIDR Allocator', - description: 'Pack requested subnet sizes into network pools using bin-packing algorithms (first-fit, best-fit)', + description: 'Allocate subnets into network pools using first-fit or best-fit algorithms', icon: 'cidr-allocator', keywords: ['cidr', 'allocator', 'bin-packing', 'first-fit', 'best-fit', 'subnet', 'allocation', 'packing'], }, { href: makePath('/cidr/alignment'), label: 'CIDR Alignment', - description: 'Check if IP addresses and ranges align to CIDR prefix boundaries with optimization suggestions', + description: 'Check if IP addresses align to CIDR prefix boundaries', icon: 'cidr-alignment', keywords: [ 'cidr', @@ -347,7 +373,7 @@ export const SUB_NAV: Record = { { href: makePath('/cidr/set-operations/diff'), label: 'Difference (A - B)', - description: 'Compute A - B set operations on CIDR blocks, ranges, and IP addresses', + description: 'Subtract CIDR blocks, ranges, and IPs from another set', icon: 'diff', keywords: [ 'set', @@ -369,7 +395,7 @@ export const SUB_NAV: Record = { { href: makePath('/cidr/set-operations/overlap'), label: 'Overlap (A ∩ B)', - description: 'Detect intersections between two sets of IP addresses and ranges', + description: 'Find overlapping IPs and ranges between two sets', icon: 'intersection', keywords: [ 'set', @@ -390,7 +416,7 @@ export const SUB_NAV: Record = { { href: makePath('/cidr/set-operations/contains'), label: 'Contains (A ⊆ B)', - description: 'Check if one set fully contains another with detailed containment analysis', + description: 'Check if one IP set contains another', icon: 'containment', keywords: [ 'set', diff --git a/src/lib/constants/site.ts b/src/lib/constants/site.ts index b520bed..bb5f813 100644 --- a/src/lib/constants/site.ts +++ b/src/lib/constants/site.ts @@ -10,6 +10,8 @@ export const site = { url: 'https://networking-toolbox.as93.net', image: 'https://networking-toolbox.as93.net/og-image.png', repo: 'https://github.com/lissy93/networking-toolbox', + mirror: 'https://codeberg.org/alicia/networking-toolbox', + docker: 'https://hub.docker.com/r/lissy93/networking-toolbox', }; export const about = { diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5c64ac7..5c5578a 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -47,6 +47,16 @@ // Dynamic favicon based on page icon const dynamicFavicon = $derived.by(() => { void faviconTrigger; // Include in order to force updates when theme changes + + // Check if we're on an error page + const isErrorPage = $page.status >= 400; + if (isErrorPage) { + const errorFaviconDataUri = generateFaviconDataUri('lost'); + if (errorFaviconDataUri) { + return errorFaviconDataUri; + } + } + const currentPath = $page.url.pathname; const pageDetailsWithIcon = getPageDetailsWithIcon(currentPath); diff --git a/src/routes/about/(sections)/deploying/+page.svelte b/src/routes/about/(sections)/deploying/+page.svelte new file mode 100644 index 0000000..2844418 --- /dev/null +++ b/src/routes/about/(sections)/deploying/+page.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index 17c5373..9fe2e11 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -1,6 +1,6 @@ + +
+
+

DNSSEC Validation Chain Checker

+

Validate DNSSEC chain from root to domain, verify DS/DNSKEY matching and RRSIG signatures

+
+ + +
+
+ + +

Quick Examples

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

Domain Name

+
+
+
{ + e.preventDefault(); + validateChain(); + }} + > +
+ + clearExampleSelection()} + /> +
+ + +
+
+
+ + {#if error} +
+
+
+ +
+ Validation Failed +

{error}

+
+
+
+
+ {/if} + + {#if loading} +
+
+
+ +
+

Validating DNSSEC Chain

+

Querying DNS records from root to {domain}...

+
+
+
+
+ {/if} + + {#if results} +
+
+

DNSSEC Validation Results

+
+
+ +
+
+

+ {#if results.valid} + + DNSSEC Valid + {:else} + + DNSSEC Invalid + {/if} +

+
+
+
+
+ Domain: + {results.domain} +
+
+ Chain Links: + {results.summary.totalLinks} +
+
+ Validated: + {results.summary.validatedLinks}/{results.summary.totalLinks} +
+
+ Status: + + {results.valid ? 'Secure' : 'Broken Chain'} + +
+
+ + {#if results.summary.errors.length > 0} +
+

Validation Errors:

+
    + {#each results.summary.errors as err, i (i)} +
  • {err}
  • + {/each} +
+
+ {/if} +
+
+ + +
+
+

DNSSEC Chain

+
+
+
+ {#each results.chain as link, i (i)} + + + {#if i < results.chain.length - 1} +
+ +
+ {/if} + {/each} +
+
+
+
+
+ {/if} +
+ + diff --git a/src/routes/diagnostics/tls/banner/+page.svelte b/src/routes/diagnostics/tls/banner/+page.svelte index 0042d1b..b63615e 100644 --- a/src/routes/diagnostics/tls/banner/+page.svelte +++ b/src/routes/diagnostics/tls/banner/+page.svelte @@ -306,6 +306,7 @@
{#if results.banner} + {:else}
From d47d1c52cf62499cc3e7271785fed776b8b29bdd Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 6 Oct 2025 20:17:20 +0100 Subject: [PATCH 6/6] Resolved failing tests and linter checks --- src/routes/api/internal/diagnostics/tls/+server.ts | 2 +- src/routes/diagnostics/tls/banner/+page.svelte | 4 ++-- tests/unit/lib/constants/nav.test.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/api/internal/diagnostics/tls/+server.ts b/src/routes/api/internal/diagnostics/tls/+server.ts index a576ac0..683a63f 100644 --- a/src/routes/api/internal/diagnostics/tls/+server.ts +++ b/src/routes/api/internal/diagnostics/tls/+server.ts @@ -619,7 +619,7 @@ async function grabServiceBanner(host: string, port: number, timeout: number = 5 }, 2000); // 2 second max for banner collection }); - socket.on('data', (data: Buffer) => { + socket.on('data', (data: Uint8Array) => { hasReceivedData = true; banner += data.toString(); diff --git a/src/routes/diagnostics/tls/banner/+page.svelte b/src/routes/diagnostics/tls/banner/+page.svelte index b63615e..7cccc06 100644 --- a/src/routes/diagnostics/tls/banner/+page.svelte +++ b/src/routes/diagnostics/tls/banner/+page.svelte @@ -47,8 +47,8 @@ ]; $effect(() => { - if (service && service !== 'custom' && services[service]) { - port = services[service].port; + if (service && service !== 'custom' && services[service as keyof typeof services]) { + port = services[service as keyof typeof services].port; } }); diff --git a/tests/unit/lib/constants/nav.test.ts b/tests/unit/lib/constants/nav.test.ts index 12e2f79..312d5b9 100644 --- a/tests/unit/lib/constants/nav.test.ts +++ b/tests/unit/lib/constants/nav.test.ts @@ -166,7 +166,7 @@ describe('nav.ts', () => { const details = getPageDetails('/subnetting/ipv4-subnet-calculator'); expect(details).toBeDefined(); expect(details?.title).toBe('IPv4 Subnet Calculator'); - expect(details?.description).toContain('Calculate subnet information'); + expect(details?.description).toContain('Calculate subnet masks'); expect(details?.keywords).toBeInstanceOf(Array); expect(details?.keywords).toContain('subnet'); });