Merge pull request #4 from Lissy93/feat/new-lookups

Feat/new lookups
This commit is contained in:
Alicia Sykes authored and GitHub committed 2025-10-06 20:29:24 +01:00
commit 3a40ff9eb7
25 files changed
+3860 -70

No files matched your search

+21 -16
View File
@@ -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 @@
<div class="primary-dropdown">
<div class="primary-content">
{#each getSubPages(item.href) as subItem ('href' in subItem ? subItem.href : subItem.title)}
{#if 'href' in subItem}
<!-- Direct nav item -->
{#if 'href' in subItem && subItem.label}
<!-- Direct nav item with label -->
<a
href={subItem.href}
class="dropdown-link {isActive(currentPath, subItem.href) ? 'active' : ''}"
@@ -214,7 +219,7 @@
on:mouseleave={hideSubDropdown}
>
<div class="secondary-content">
{#each subItem.items as groupItem (groupItem.href)}
{#each subItem.items.filter((i) => i.label) as groupItem (groupItem.href)}
<a
href={groupItem.href}
class="dropdown-link {isActive(currentPath, groupItem.href) ? 'active' : ''}"
+5 -1
View File
@@ -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)
+4 -1
View File
@@ -9,7 +9,10 @@
export let idPrefix: string = 'main-';
// Remove duplicates based on href, keeping the first occurrence
$: uniqueTools = tools.filter((tool, index, array) => 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);
</script>
{#if uniqueTools.length === 0 && searchQuery}
@@ -1,4 +1,8 @@
<section id="api">
<h2>API</h2>
<p>Yes, we have an API! It's free to use, doesn't require an API key nor CORS.</p>
<p>
Yes, we have an API! It's free to use, doesn't require an API key nor CORS.<br />
Try calling <a href="/api"><code>GET https://networkingtoolbox.net/api</code></a>, or checkout the
<a href="/api-docs.html">API Docs</a>.
</p>
</section>
@@ -2,7 +2,7 @@
</script>
<section id="building">
<h2>Building from Source</h2>
<h2>Building</h2>
<h3>Prerequisites</h3>
<p>
Make sure you have <a href="https://nodejs.org/en/download/" target="_blank" rel="noopener noreferrer">Node.js</a>
@@ -28,7 +28,7 @@
<code>npm run tsc</code>
<code>npm run lint</code>
</div>
<!--
<h3>Deploying</h3>
<ul>
<li>
@@ -46,7 +46,7 @@
Build the Docker image, with <code>docker build -t networking-toolbox .</code>
then run <code>docker run -p 8080:8080 networking-toolbox</code>
</li>
</ul>
</ul> -->
<h3>Contributing</h3>
<p>
@@ -0,0 +1,58 @@
<script>
import '../../../../styles/page-specific/about-page.scss';
</script>
<section id="deploying">
<h2>Deploying</h2>
<p>
As well as our free hosted version, at <a href="https://networkingtoolbox.net">networkingtoolbox.net</a>, 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.
</p>
<h3>Option #1 - Docker</h3>
<p>With Docker installed, just run the following command:</p>
<div class="code">
<code>docker run -p 8080:8080 lissy93/networking-toolbox</code>
</div>
<p>
You can also checkout our <a href="https://github.com/Lissy93/networking-toolbox/blob/main/docker-compose.yml"
><code>docker-compose.yml</code></a
>, using the
<a href="https://hub.docker.com/r/lissy93/networking-toolbox"><code>lissy93/networking-toolbox</code></a> image from
DockerHub.
</p>
<h3>Option #2 - Free Hosting Provider</h3>
<p>
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.
</p>
<p>Alternatively, just click one of the buttons below!</p>
<h3>Option #3 - GitHub Pages</h3>
<ol>
<li>Fork the repository (you'll need a free GitHub account)</li>
<li>Go to your new repo's Settings → Pages → Source and select the <code>gh-pages</code> branch</li>
<li>Then, head to the Actions tab, find the "Deploy to GitHub Pages" workflow, and trigger it</li>
<li>Visit <code>https://[your-username].github.io/networking-toolbox/</code> to see your deployed app</li>
</ol>
<h3>Option #4 - Source</h3>
<p>
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 <a href="/about/building"
>Building Instructions</a
>, or you can check out the docs in the repo.
</p>
</section>
<style>
ol {
padding-left: 2rem;
}
h3 {
margin-top: var(--spacing-lg);
}
</style>
+16
View File
@@ -236,5 +236,21 @@ export const iconMap: Record<string, string> = {
'spf-flatten': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 160C176 162.7 177.2 165.2 179.4 166.9L343.4 294.5C357.8 305.7 378.1 305.7 392.5 294.5L556.6 166.9C558.7 165.2 560 162.7 560 160C560 151.2 552.8 144 544 144L192 144C183.2 144 176 151.2 176 160zM176 225.1L176 384C176 392.8 183.2 400 192 400L544 400C552.8 400 560 392.8 560 384L560 225.1L422 332.4C390.2 357.1 345.7 357.1 313.9 332.4L176 225.1z"/><path d="M192 144L544 144C552.8 144 560 151.2 560 160C560 162.7 558.8 165.2 556.6 166.9L392.6 294.5C378.2 305.7 357.9 305.7 343.5 294.5L179.4 166.9C177.3 165.2 176 162.7 176 160C176 151.2 183.2 144 192 144zM560 225.1L560 384C560 392.8 552.8 400 544 400L192 400C183.2 400 176 392.8 176 384L176 225.1L314 332.4C345.8 357.1 390.3 357.1 422.1 332.4L560 225.1zM128 160L128 384C128 419.3 156.7 448 192 448L544 448C579.3 448 608 419.3 608 384L608 160C608 124.7 579.3 96 544 96L192 96C156.7 96 128 124.7 128 160zM56 192C42.7 192 32 202.7 32 216L32 480C32 515.3 60.7 544 96 544L488 544C501.3 544 512 533.3 512 520C512 506.7 501.3 496 488 496L96 496C87.2 496 80 488.8 80 480L80 216C80 202.7 69.3 192 56 192z"/></svg>`,
'ocsp-stapling': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M48 243.1C48 247.4 50.9 251.2 55.2 252.3L459.6 353.4C481 358.8 496 378 496 400L496 496L592 496L592 360C591.9 359.2 591.8 358.4 591.7 357.6C589.8 341.7 580 327.7 565.5 320.4L239.3 157.3C221.8 148.6 202.5 144 182.9 144C143.3 144 106 162.7 82.2 194.4L49.9 237.5C48.7 239.1 48 241.1 48 243.2z"/><path d="M448 448L448 496L56 496C42.7 496 32 506.7 32 520C32 533.3 42.7 544 56 544L592 544C618.5 544 640 522.5 640 496L640 352L639.3 351.9C635.5 320.1 616 292 586.9 277.5L260.7 114.4C236.6 102.3 209.9 96 182.9 96C128.2 96 76.7 121.8 43.8 165.6L11.5 208.7C4 218.6 0 230.7 0 243.1C0 269.5 17.9 292.5 43.5 298.9L64 304L64 408C64 430.1 81.9 448 104 448L448 448zM448 400L112 400L112 316L448 400zM520 496L496 496L496 400C496 378 481 358.8 459.6 353.4L55.2 252.3C51 251.2 48 247.5 48 243.1C48 241.1 48.7 239.1 49.9 237.4L82.2 194.3C106 162.6 143.3 143.9 182.9 143.9C202.4 143.9 221.7 148.5 239.2 157.2L565.5 320.4C580 327.7 589.8 341.7 591.7 357.6C591.8 358.4 591.9 359.2 592 360L592 496L520 496z"/></svg>`,
'tls-cipher-presets': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d=""/><path d="M144 192C144 165.5 165.5 144 192 144C218.5 144 240 165.5 240 192L240 199.9C240 225.6 238 251.3 233.9 276.7L123.5 314.5C87.9 326.7 64 360.1 64 397.7L64 474C64 512.6 95.3 544 134 544C158.6 544 181.4 531.1 194 510L209.9 483.6C239.5 434.2 261 380.3 273.5 324.1L275.3 316L275.9 313.1L352.7 286.8L329.4 351.9C326.8 359.3 327.9 367.4 332.4 373.8C336.3 379.3 342.3 382.9 348.9 383.8C354 375 360.5 367.1 368 360.4L368 336C368 296.6 385.8 261.4 413.8 237.9C412.7 235.4 411.1 233.1 409.1 231.1C402.6 224.5 393 222.3 384.2 225.2L284.7 259.3C286.9 239.6 288 219.7 288 199.8L288 191.9C288 138.9 245 95.9 192 95.9C139 95.9 96 139 96 192L96 232C96 245.3 106.7 256 120 256C133.3 256 144 245.3 144 232L144 192zM289.5 432C282.7 448.3 275.2 464.3 266.9 480L336 480L336 432L289.5 432zM139.1 359.9L222.4 331.4C210.7 376.2 192.6 419.1 168.8 458.9L152.9 485.3C148.9 491.9 141.8 496 134.1 496C122 496 112.1 486.2 112.1 474L112.1 397.7C112.1 380.6 123 365.4 139.2 359.9zM528 336.1L528 384L464 384L464 336.1C464 318.4 478.3 304.1 496 304.1C513.7 304.1 528 318.4 528 336.1zM384 432L384 528C384 554.5 405.5 576 432 576L560 576C586.5 576 608 554.5 608 528L608 432C608 411.1 594.6 393.3 576 386.7L576 336.1C576 291.9 540.2 256.1 496 256.1C451.8 256.1 416 291.9 416 336.1L416 386.7C397.4 393.3 384 411.1 384 432z"/></svg>`,
cookie: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M128.9 311.2L143.4 394C145.5 406.1 151.4 417.2 160.2 425.7L220.5 484.1C229.3 492.6 240.5 498.1 252.5 499.8L335.5 511.5C347.5 513.2 359.8 511 370.6 505.3L444.6 465.8C455.3 460 464 451 469.4 440L506.1 364.5C508.3 360 509.8 355.4 510.8 350.6C459.8 333.1 419.4 292.9 401.7 241.9C345.6 226.7 300.7 184.4 281.7 130C277.4 131.1 273.3 132.8 269.3 134.9L195.3 174.4C184.7 180 176 189 170.6 200L133.9 275.6C128.5 286.6 126.8 299.1 128.9 311.2zM272 400C272 417.7 257.7 432 240 432C222.3 432 208 417.7 208 400C208 382.3 222.3 368 240 368C257.7 368 272 382.3 272 400zM304 240C304 257.7 289.7 272 272 272C254.3 272 240 257.7 240 240C240 222.3 254.3 208 272 208C289.7 208 304 222.3 304 240zM432 368C432 385.7 417.7 400 400 400C382.3 400 368 385.7 368 368C368 350.3 382.3 336 400 336C417.7 336 432 350.3 432 368z"/><path d="M245.9 547.3C223.8 544.2 203.2 534.1 187.2 518.6L126.8 460.2C110.8 444.6 100 424.3 96.2 402.3L81.6 319.5C77.7 297.4 80.9 274.7 90.7 254.6L127.4 179C137.2 158.9 153.1 142.4 172.8 131.8L246.8 92.3C266.5 81.8 289.1 77.8 311.2 80.9C316.6 81.7 320.7 86.1 321.5 91.5C329.9 146.2 373 189.6 427.7 198.3C435.4 199.5 441.6 205.4 443.4 212.9C455 263.2 496.3 302.1 547.9 310.3C553.2 311.1 557.6 315.1 558.5 320.4C562.4 342.5 559.2 365.2 549.4 385.3L512.6 461C502.8 481.1 486.9 497.6 467.2 508.2L393.2 547.7C373.5 558.2 350.9 562.2 328.8 559.1L245.8 547.4zM269.4 134.8L195.4 174.3C184.7 180 176 189 170.6 200L133.9 275.6C128.5 286.6 126.8 299.1 128.9 311.2L143.4 394C145.5 406.1 151.4 417.2 160.2 425.7L220.5 484.1C229.3 492.6 240.5 498.1 252.5 499.8L335.5 511.5C347.5 513.2 359.8 511 370.6 505.3L444.6 465.8C455.3 460 464 451 469.4 440L506.1 364.5C508.3 360 509.8 355.4 510.8 350.6C459.8 333.1 419.4 292.9 401.7 241.9C345.6 226.7 300.7 184.4 281.7 130C277.4 131.1 273.3 132.8 269.3 134.9zM272 208C289.7 208 304 222.3 304 240C304 257.7 289.7 272 272 272C254.3 272 240 257.7 240 240C240 222.3 254.3 208 272 208zM240 368C257.7 368 272 382.3 272 400C272 417.7 257.7 432 240 432C222.3 432 208 417.7 208 400C208 382.3 222.3 368 240 368zM368 368C368 350.3 382.3 336 400 336C417.7 336 432 350.3 432 368C432 385.7 417.7 400 400 400C382.3 400 368 385.7 368 368z"/></svg>`,
archive: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M112 144L112 208L528 208L528 144L112 144zM144 256L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 256L144 256zM224 328C224 314.7 234.7 304 248 304L392 304C405.3 304 416 314.7 416 328C416 341.3 405.3 352 392 352L248 352C234.7 352 224 341.3 224 328z"/><path d="M528 144L528 208L112 208L112 144L528 144zM64 208C64 228.9 77.4 246.7 96 253.3L96 480C96 515.3 124.7 544 160 544L480 544C515.3 544 544 515.3 544 480L544 253.3C562.6 246.7 576 228.9 576 208L576 144C576 117.5 554.5 96 528 96L112 96C85.5 96 64 117.5 64 144L64 208zM144 480L144 256L496 256L496 480C496 488.8 488.8 496 480 496L160 496C151.2 496 144 488.8 144 480zM248 304C234.7 304 224 314.7 224 328C224 341.3 234.7 352 248 352L392 352C405.3 352 416 341.3 416 328C416 314.7 405.3 304 392 304L248 304z"/></svg>`,
compress: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M164.4 240L240.5 240L240.5 163.9L164.4 240zM164.4 400L240.5 476.1L240.5 400L164.4 400zM400.5 163.9L400.5 240L476.6 240L400.5 163.9zM400.5 400L400.5 476.1L476.6 400L400.5 400z"/><path d="M71.5 71C62.1 80.4 62.1 95.6 71.5 104.9L151.5 184.9L105.8 230.6C99.8 236.6 96.4 244.7 96.4 253.2L96.4 255.9C96.4 273.6 110.7 287.9 128.4 287.9L256.4 287.9C274.1 287.9 288.4 273.6 288.4 255.9L288.4 127.9C288.4 110.2 274.1 95.9 256.4 95.9L253.7 95.9C245.2 95.9 237.1 99.3 231.1 105.3L185.5 151L105.5 71C96.1 61.7 80.9 61.7 71.5 71zM569.5 105C578.9 95.6 578.9 80.4 569.5 71.1C560.1 61.8 544.9 61.7 535.6 71.1L455.6 151.1L409.9 105.4C403.9 99.4 395.8 96 387.3 96L384.6 96C366.9 96 352.6 110.3 352.6 128L352.6 256C352.6 273.7 366.9 288 384.6 288L512.6 288C530.3 288 544.6 273.7 544.6 256L544.6 253.3C544.6 244.8 541.2 236.7 535.2 230.7L489.5 185L569.5 105zM569.5 535.1L489.5 455.1L535.2 409.4C541.2 403.4 544.6 395.3 544.6 386.8L544.6 384.1C544.6 366.4 530.3 352.1 512.6 352.1L384.6 352.1C366.9 352.1 352.6 366.4 352.6 384.1L352.6 512.1C352.6 529.8 366.9 544.1 384.6 544.1L387.3 544.1C395.8 544.1 403.9 540.7 409.9 534.7L455.6 489L535.6 569C545 578.4 560.2 578.4 569.5 569C578.8 559.6 578.9 544.4 569.5 535.1zM71.5 535C62.1 544.4 62.1 559.6 71.5 568.9C80.9 578.2 96.1 578.3 105.4 568.9L185.4 488.9L231.1 534.6C237.1 540.6 245.2 544 253.7 544L256.4 544C274.1 544 288.4 529.7 288.4 512L288.4 384C288.4 366.3 274.1 352 256.4 352L128.4 352C110.7 352 96.4 366.3 96.4 384L96.4 386.7C96.4 395.2 99.8 403.3 105.8 409.3L151.5 455L71.5 535zM476.6 240L400.5 240L400.5 163.9L476.6 240zM400.5 476.1L400.5 400L476.6 400L400.5 476.1zM164.4 240L240.5 163.9L240.5 240L164.4 240zM240.5 476.1L164.4 400L240.5 400L240.5 476.1z"/></svg>`,
'ref-common-subnets': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M400 144L400 208L464 208L464 144L400 144zM400 368L400 496L528 496L528 368L400 368z"/><path d="M400 208L400 144L464 144L464 208L400 208zM352 208C352 234.5 373.5 256 400 256L464 256C490.5 256 512 234.5 512 208L512 144C512 117.5 490.5 96 464 96L400 96C373.5 96 352 117.5 352 144L352 208zM400 496L400 368L528 368L528 496L400 496zM352 496C352 522.5 373.5 544 400 544L528 544C554.5 544 576 522.5 576 496L576 368C576 341.5 554.5 320 528 320L400 320C373.5 320 352 341.5 352 368L352 496zM209 103C199.6 93.6 184.4 93.6 175.1 103L87 191C77.6 200.4 77.6 215.6 87 224.9C96.4 234.2 111.6 234.3 120.9 224.9L167.9 177.9L167.9 520C167.9 533.3 178.6 544 191.9 544C205.2 544 215.9 533.3 215.9 520L215.9 177.9L262.9 224.9C272.3 234.3 287.5 234.3 296.8 224.9C306.1 215.5 306.2 200.3 296.8 191L209 103z"/></svg>`,
'ref-network-classes': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d=""/><path d="M297.5 449L209.5 537C200.1 546.4 184.9 546.4 175.6 537L87.6 449C78.2 439.6 78.2 424.4 87.6 415.1C97 405.8 112.2 405.7 121.5 415.1L168.5 462.1L168.5 120C168.5 106.7 179.2 96 192.5 96C205.8 96 216.5 106.7 216.5 120L216.5 462.1L263.5 415.1C272.9 405.7 288.1 405.7 297.4 415.1C306.7 424.5 306.8 439.7 297.4 449zM470 109.3L550 269.3C555.9 281.2 551.1 295.6 539.3 301.5C527.5 307.4 513 302.6 507 290.7L493.4 263.5C491.8 263.8 490.2 264 488.5 264L403.3 264L389.9 290.7C384 302.6 369.6 307.4 357.7 301.4C345.8 295.4 341 281.1 347 269.2L427 109.2C431.1 101.1 439.4 95.9 448.5 95.9C457.6 95.9 465.9 101 470 109.2zM448.5 173.7L427.3 216L469.6 216L448.4 173.7zM352.5 376C352.5 362.7 363.2 352 376.5 352L520.5 352C530.2 352 539 357.8 542.7 366.8C546.4 375.8 544.4 386.1 537.5 393L434.5 496L520.6 496C533.9 496 544.6 506.7 544.6 520C544.6 533.3 533.9 544 520.6 544L376.6 544C366.9 544 358.1 538.2 354.4 529.2C350.7 520.2 352.7 509.9 359.6 503L462.6 400L376.5 400C363.2 400 352.5 389.3 352.5 376z"/></svg>`,
'ref-reserved-ranges': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M136.9 224L288.5 124.7L302.1 133.6C293.3 154 288.5 176.4 288.5 200C288.5 208.1 289.1 216.2 290.2 224L136.9 224zM144.5 272L208.5 272L208.5 432L144.5 432L144.5 272zM256.5 272L304.7 272C309.2 281.4 314.5 290.3 320.5 298.7L320.5 432L256.5 432L256.5 272zM368.5 343.1C387.6 354.9 409.3 362.9 432.5 366.3L432.5 432L368.5 432L368.5 343.1z"/><path d="M301.7 75.9L327.3 92.7C317 105 308.5 118.7 302.1 133.6L288.5 124.7L136.9 224L290.2 224C292.6 240.9 297.6 257.1 304.7 272L256.5 272L256.5 432L320.5 432L320.5 298.7C333.4 316.5 349.7 331.6 368.5 343.2L368.5 432.1L432.5 432.1L432.5 366.4C440.3 367.5 448.3 368.1 456.5 368.1C464.7 368.1 472.7 367.5 480.5 366.4L480.5 432.1L488.5 432.1C501.8 432.1 512.5 442.8 512.5 456.1C512.5 469.4 501.8 480.1 488.5 480.1L88.5 480.1C75.2 480.1 64.5 469.4 64.5 456.1C64.5 442.8 75.2 432.1 88.5 432.1L96.5 432.1L96.5 272.1L56.5 272.1C45.9 272.1 36.5 265.1 33.5 255C30.5 244.9 34.5 233.9 43.3 228.1L275.3 76.1C283.3 70.9 293.6 70.9 301.6 76.1zM144.5 432L208.5 432L208.5 272L144.5 272L144.5 432zM56.5 528L520.5 528C533.8 528 544.5 538.7 544.5 552C544.5 565.3 533.8 576 520.5 576L56.5 576C43.2 576 32.5 565.3 32.5 552C32.5 538.7 43.2 528 56.5 528zM456.5 272C496.3 272 528.5 239.8 528.5 200C528.5 160.2 496.3 128 456.5 128C416.7 128 384.5 160.2 384.5 200C384.5 239.8 416.7 272 456.5 272zM456.5 320C390.2 320 336.5 266.3 336.5 200C336.5 133.7 390.2 80 456.5 80C522.8 80 576.5 133.7 576.5 200C576.5 224.5 569.2 247.3 556.6 266.3L617.5 327.2C626.9 336.6 626.9 351.8 617.5 361.1C608.1 370.4 592.9 370.5 583.6 361.1L522.7 300.2C503.7 312.7 481 320 456.6 320z"/></svg>`,
terminal: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M144 160L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 160C496 151.2 488.8 144 480 144L160 144C151.2 144 144 151.2 144 160zM199 223C208.4 213.6 223.6 213.6 232.9 223L312.9 303C322.3 312.4 322.3 327.6 312.9 336.9L232.9 416.9C223.5 426.3 208.3 426.3 199 416.9C189.7 407.5 189.6 392.3 199 383L262 320L199 257C189.6 247.6 189.6 232.4 199 223.1zM288 424C288 410.7 298.7 400 312 400L424 400C437.3 400 448 410.7 448 424C448 437.3 437.3 448 424 448L312 448C298.7 448 288 437.3 288 424z"/><path d="M480 144C488.8 144 496 151.2 496 160L496 480C496 488.8 488.8 496 480 496L160 496C151.2 496 144 488.8 144 480L144 160C144 151.2 151.2 144 160 144L480 144zM160 96C124.7 96 96 124.7 96 160L96 480C96 515.3 124.7 544 160 544L480 544C515.3 544 544 515.3 544 480L544 160C544 124.7 515.3 96 480 96L160 96zM199 223C189.6 232.4 189.6 247.6 199 256.9L262 319.9L199 382.9C189.6 392.3 189.6 407.5 199 416.8C208.4 426.1 223.6 426.2 232.9 416.8L312.9 336.8C322.3 327.4 322.3 312.2 312.9 302.9L232.9 222.9C223.5 213.5 208.3 213.5 199 222.9zM312 400C298.7 400 288 410.7 288 424C288 437.3 298.7 448 312 448L424 448C437.3 448 448 437.3 448 424C448 410.7 437.3 400 424 400L312 400z"/></svg>`,
'file-x': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 128L176 142.2L464 430.2L464 272L376 272C336.2 272 304 239.8 304 200L304 112L192 112C183.2 112 176 119.2 176 128z"/><path d="M73 39.1C63.6 29.7 48.4 29.7 39.1 39.1C29.8 48.5 29.7 63.7 39 73.1L567 601.1C576.4 610.5 591.6 610.5 600.9 601.1C610.2 591.7 610.3 576.5 600.9 567.2L511.9 478.2L511.9 250.6C511.9 233.6 505.2 217.3 493.2 205.3L370.7 82.7C358.7 70.7 342.5 64 325.5 64L192 64C166.5 64 144.6 78.9 134.2 100.4L73 39.1zM176 142.1L176 128C176 119.2 183.2 112 192 112L304 112L304 200C304 239.8 336.2 272 376 272L464 272L464 430.2L176 142.2zM176 512L176 277.8L128 229.8L128 512C128 547.3 156.7 576 192 576L448 576C455.8 576 463.3 574.6 470.2 572L426.2 528L192 528C183.2 528 176 520.8 176 512zM444.1 224L376 224C362.7 224 352 213.3 352 200L352 131.9L444.1 224z"/></svg>`,
folder: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M112 160L112 448C112 456.8 119.2 464 128 464L512 464C520.8 464 528 456.8 528 448L528 208C528 199.2 520.8 192 512 192L362.7 192C345.4 192 328.5 186.4 314.7 176L276.3 147.2C273.5 145.1 270.2 144 266.7 144L128 144C119.2 144 112 151.2 112 160z"/><path d="M128 464L512 464C520.8 464 528 456.8 528 448L528 208C528 199.2 520.8 192 512 192L362.7 192C345.4 192 328.5 186.4 314.7 176L276.3 147.2C273.5 145.1 270.2 144 266.7 144L128 144C119.2 144 112 151.2 112 160L112 448C112 456.8 119.2 464 128 464zM512 512L128 512C92.7 512 64 483.3 64 448L64 160C64 124.7 92.7 96 128 96L266.7 96C280.5 96 294 100.5 305.1 108.8L343.5 137.6C349 141.8 355.8 144 362.7 144L512 144C547.3 144 576 172.7 576 208L576 448C576 483.3 547.3 512 512 512z"/></svg>`,
package: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M128 240.8L128 410.4C128 424.9 135.9 438.3 148.6 445.4L296 527.3L296 334.2L128 240.9zM146.2 196L320 292.5L367 266.4L194.3 169.3L146.2 196zM274.8 124.6L447.5 221.7L493.8 196L339.4 110.2C327.3 103.5 312.6 103.5 300.5 110.2L274.8 124.6zM344 334.1L344 527.2L491.4 445.3C504.1 438.2 512 424.9 512 410.3L512 240.7L480 258.5L480 352.7C480 364.3 473.8 374.9 463.7 380.6L423.9 403C413.2 409 400.1 401.3 400.1 389.1L400.1 303L344.1 334.1z"/><path d="M296 527.2L148.6 445.3C135.9 438.2 128 424.9 128 410.3L128 240.7L296 334L296 527.1zM367 266.4L320 292.5L146.2 196L194.3 169.3L367 266.4zM274.8 124.6L300.6 110.3C312.7 103.6 327.4 103.6 339.5 110.3L493.9 196.1L447.6 221.8L274.9 124.7zM400 303L400 389.1C400 401.3 413.2 409 423.8 403L463.6 380.6C473.7 374.9 479.9 364.3 479.9 352.7L479.9 258.5L511.9 240.7L511.9 410.3C511.9 424.8 504 438.2 491.3 445.3L344 527.2L344 334.1L400 303zM277.2 571.7C303.8 586.5 336.1 586.5 362.7 571.7L514.7 487.3C542.6 471.8 560 442.3 560 410.4L560 225C560 195.9 544.2 169.2 518.8 155.1L362.7 68.3C336.1 53.5 303.8 53.5 277.2 68.3L121.1 155C95.8 169.1 80 195.9 80 224.9L80 410.3C80 442.3 97.3 471.7 125.3 487.2L277.3 571.6z"/></svg>`,
tag: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M128.1 152C128.1 138.7 138.8 128 152.1 128L308.2 128C314.6 128 320.7 130.5 325.2 135L533.2 343C539.1 348.9 541.3 357.1 539.8 364.7C538.3 368.8 535.9 372.7 532.6 376L452.9 457.2L377 533.1C367.6 542.5 352.4 542.5 343.1 533.1L135.1 325.1C130.6 320.6 128.1 314.5 128.1 308.1L128.1 152zM176.1 208C176.1 225.7 190.4 240 208.1 240C225.8 240 240.1 225.7 240.1 208C240.1 190.3 225.8 176 208.1 176C190.4 176 176.1 190.3 176.1 208z"/><path d="M128.1 152C128.1 138.7 138.8 128 152.1 128L308.2 128C314.6 128 320.7 130.5 325.2 135L533.2 343C542.6 352.4 542.6 367.6 533.2 376.9L377.1 533.1C367.7 542.5 352.5 542.5 343.2 533.1L135.2 325.1C130.7 320.6 128.2 314.5 128.2 308.1L128.1 152zM152.1 80C112.3 80 80.1 112.2 80.1 152L80.1 308.1C80.1 327.2 87.7 345.5 101.2 359L309.2 567C337.3 595.1 382.9 595.1 411 567L567.1 410.9C595.2 382.8 595.2 337.2 567.1 309.1L359.1 101.1C345.6 87.6 327.3 80 308.2 80L152.1 80zM208.1 240C225.8 240 240.1 225.7 240.1 208C240.1 190.3 225.8 176 208.1 176C190.4 176 176.1 190.3 176.1 208C176.1 225.7 190.4 240 208.1 240z"/></svg>`,
monitor: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M112 160L112 336L528 336L528 160C528 151.2 520.8 144 512 144L128 144C119.2 144 112 151.2 112 160zM284.3 528L355.6 528L347.6 480L292.3 480L284.3 528z"/><path d="M512 144C520.8 144 528 151.2 528 160L528 336L112 336L112 160C112 151.2 119.2 144 128 144L512 144zM528 384L528 416C528 424.8 520.8 432 512 432L128 432C119.2 432 112 424.8 112 416L112 384L528 384zM128 96C92.7 96 64 124.7 64 160L64 416C64 451.3 92.7 480 128 480L243.7 480L235.7 528L184 528C170.7 528 160 538.7 160 552C160 565.3 170.7 576 184 576L456 576C469.3 576 480 565.3 480 552C480 538.7 469.3 528 456 528L404.3 528L396.3 480L512 480C547.3 480 576 451.3 576 416L576 160C576 124.7 547.3 96 512 96L128 96zM284.3 528L292.3 480L347.6 480L355.6 528L284.3 528z"/></svg>`,
lost: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M190.8 157C226.3 128.8 271.2 112 320 112C434.9 112 528 205.1 528 320C528 368.8 511.2 413.7 483 449.2L393.4 359.6L444.6 226.4C452.1 207 433 187.9 413.6 195.4L280.4 246.6L190.8 157z"/><path d="M73 39.1C63.6 29.7 48.4 29.7 39.1 39.1C29.8 48.5 29.7 63.7 39 73.1L567 601.1C576.4 610.5 591.6 610.5 600.9 601.1C610.2 591.7 610.3 576.5 600.9 567.2L517.1 483.4C553.9 439 576 382.1 576 320C576 178.6 461.4 64 320 64C257.9 64 201 86.1 156.7 122.8L73 39.1zM190.8 157C226.3 128.8 271.2 112 320 112C434.9 112 528 205.1 528 320C528 368.8 511.2 413.7 483 449.2L393.4 359.6L444.6 226.4C452.1 207 433 187.9 413.6 195.4L280.4 246.6L190.8 157zM407.1 509C380.6 521.2 351.1 528.1 320 528.1C205.1 528.1 112 435 112 320.1C112 289 118.8 259.5 131.1 233L95.3 197.2C75.3 233.7 64 275.5 64 320C64 461.4 178.6 576 320 576C364.5 576 406.4 564.6 442.8 544.7L407.1 509zM195.4 413.6C187.9 433 207 452.1 226.4 444.6L310.5 412.3L227.8 329.6L195.5 413.7z"/></svg>`,
lock: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 288L176 512C176 520.8 183.2 528 192 528L448 528C456.8 528 464 520.8 464 512L464 288C464 279.2 456.8 272 448 272C432 272 416 272 400 272C274.7 272 205.3 272 192 272C183.2 272 176 279.1 176 288z"/><path d="M240 160L240 224L400 224L400 160C400 115.8 364.2 80 320 80C275.8 80 240 115.8 240 160zM192 224L192 160C192 89.3 249.3 32 320 32C390.7 32 448 89.3 448 160L448 224C483.3 224 512 252.7 512 288L512 512C512 547.3 483.3 576 448 576L192 576C156.7 576 128 547.3 128 512L128 288C128 252.7 156.7 224 192 224zM400 272L240 272L240 272L192 272L192 272C183.2 272 176 279.2 176 288L176 512C176 520.8 183.2 528 192 528L448 528C456.8 528 464 520.8 464 512L464 288C464 279.2 456.8 272 448 272L448 272L400 272L400 272z"/></svg>`,
'dnssec-chain': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M144 160L144 224C144 232.8 151.2 240 160 240L480 240C488.8 240 496 232.8 496 224L496 160C496 151.2 488.8 144 480 144L160 144C151.2 144 144 151.2 144 160zM336 416L336 480C336 488.8 343.2 496 352 496L480 496C488.8 496 496 488.8 496 480L496 416C496 407.2 488.8 400 480 400L352 400C343.2 400 336 407.2 336 416z"/><path d="M480 144C488.8 144 496 151.2 496 160L496 224C496 232.8 488.8 240 480 240L160 240C151.2 240 144 232.8 144 224L144 160C144 151.2 151.2 144 160 144L480 144zM160 96C124.7 96 96 124.7 96 160L96 224C96 259.3 124.7 288 160 288L168 288L168 384C168 432.6 207.4 472 256 472L288 472L288 480C288 515.3 316.7 544 352 544L480 544C515.3 544 544 515.3 544 480L544 416C544 380.7 515.3 352 480 352L352 352C316.7 352 288 380.7 288 416L288 424L256 424C233.9 424 216 406.1 216 384L216 288L480 288C515.3 288 544 259.3 544 224L544 160C544 124.7 515.3 96 480 96L160 96zM480 400C488.8 400 496 407.2 496 416L496 480C496 488.8 488.8 496 480 496L352 496C343.2 496 336 488.8 336 480L336 416C336 407.2 343.2 400 352 400L480 400z"/></svg>`,
signature: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d=""/><path d="M144 192C144 165.5 165.5 144 192 144C218.5 144 240 165.5 240 192L240 199.9C240 225.6 238 251.3 233.9 276.7L123.5 314.5C87.9 326.7 64 360.1 64 397.7L64 474C64 512.6 95.3 544 134 544C158.6 544 181.4 531.1 194 510L209.9 483.6C239.5 434.2 261 380.3 273.5 324.1L275.3 316L275.9 313.1L352.7 286.8L329.4 351.9C326.8 359.3 327.9 367.4 332.4 373.8C336.3 379.3 342.3 382.9 348.9 383.8C354 375 360.5 367.1 368 360.4L368 336C368 296.6 385.8 261.4 413.8 237.9C412.7 235.4 411.1 233.1 409.1 231.1C402.6 224.5 393 222.3 384.2 225.2L284.7 259.3C286.9 239.6 288 219.7 288 199.8L288 191.9C288 138.9 245 95.9 192 95.9C139 95.9 96 139 96 192L96 232C96 245.3 106.7 256 120 256C133.3 256 144 245.3 144 232L144 192zM289.5 432C282.7 448.3 275.2 464.3 266.9 480L336 480L336 432L289.5 432zM139.1 359.9L222.4 331.4C210.7 376.2 192.6 419.1 168.8 458.9L152.9 485.3C148.9 491.9 141.8 496 134.1 496C122 496 112.1 486.2 112.1 474L112.1 397.7C112.1 380.6 123 365.4 139.2 359.9zM528 336.1L528 384L464 384L464 336.1C464 318.4 478.3 304.1 496 304.1C513.7 304.1 528 318.4 528 336.1zM384 432L384 528C384 554.5 405.5 576 432 576L560 576C586.5 576 608 554.5 608 528L608 432C608 411.1 594.6 393.3 576 386.7L576 336.1C576 291.9 540.2 256.1 496 256.1C451.8 256.1 416 291.9 416 336.1L416 386.7C397.4 393.3 384 411.1 384 432z"/></svg>`,
// '': ``,
};
+97 -31
View File
@@ -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<string, (NavItem | NavGroup)[]> = {
{
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<string, (NavItem | NavGroup)[]> = {
{
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<string, (NavItem | NavGroup)[]> = {
{
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<string, (NavItem | NavGroup)[]> = {
{
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<string, (NavItem | NavGroup)[]> = {
{
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',
@@ -1123,6 +1149,25 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
icon: 'dns-adflag',
keywords: ['dnssec', 'ad', 'flag', 'authenticated', 'data', 'doh', 'validation', 'security', 'dns'],
},
{
href: makePath('/diagnostics/dns/dnssec-validation-chain'),
label: 'DNSSEC Validation Chain',
description: 'Validate full DNSSEC chain from root to domain with DS/DNSKEY matching and RRSIG verification',
icon: 'dnssec-chain',
keywords: [
'dnssec',
'validation',
'chain',
'ds',
'dnskey',
'rrsig',
'trust',
'security',
'dns',
'root',
'authenticated',
],
},
{
href: makePath('/diagnostics/dns/soa-serial'),
label: 'SOA Serial Analyzer',
@@ -1214,6 +1259,20 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
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'],
},
],
},
{
@@ -1257,6 +1316,13 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
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'],
},
],
},
{
@@ -1889,10 +1955,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);
}
}
+2
View File
@@ -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 = {
+10
View File
@@ -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);
@@ -0,0 +1,5 @@
<script lang="ts">
import DeployingSection from '$lib/components/page-specific/about/DeployingSection.svelte';
</script>
<DeployingSection />
+4 -4
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import '../../styles/pages.scss';
import { site } from '$lib/constants/site';
import { author, site } from '$lib/constants/site';
import ToolsCarousel from '$lib/components/global/ToolsCarousel.svelte';
import { SUB_NAV } from '$lib/constants/nav';
@@ -51,9 +51,9 @@
<h3>External links</h3>
<ul>
<li><a href={site.repo}>Source on GitHub</a></li>
<li><a href={site.repo}>CodeBerg mirror</a></li>
<li><a href={site.repo}>DockerHub</a></li>
<li><a href={site.repo}>More apps...</a></li>
<li><a href={site.mirror}>CodeBerg mirror</a></li>
<li><a href={site.docker}>DockerHub</a></li>
<li><a href={author.portfolio}>More apps...</a></li>
</ul>
</div>
</section>
@@ -0,0 +1,299 @@
import { json, error } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
interface DNSSECValidationRequest {
domain: string;
}
interface DNSRecord {
name: string;
type: number;
TTL: number;
data: string;
}
interface DNSSECChainLink {
name: string;
level: number;
ds?: {
keyTag: number;
algorithm: number;
digestType: number;
digest: string;
found: boolean;
}[];
dnskey?: {
flags: number;
protocol: number;
algorithm: number;
publicKey: string;
keyTag: number;
isKSK: boolean;
isZSK: boolean;
matched?: boolean;
}[];
rrsig?: {
typeCovered: string;
algorithm: number;
labels: number;
originalTTL: number;
expiration: string;
inception: string;
keyTag: number;
signerName: string;
signature: string;
valid?: boolean;
}[];
validated: boolean;
errors: string[];
}
const DOH_PROVIDERS = {
cloudflare: 'https://cloudflare-dns.com/dns-query',
google: 'https://dns.google/resolve',
};
async function queryDNS(domain: string, type: string, provider: string = 'cloudflare'): Promise<any> {
const url = DOH_PROVIDERS[provider as keyof typeof DOH_PROVIDERS];
try {
// Both Cloudflare and Google use GET with query parameters
const response = await fetch(`${url}?name=${encodeURIComponent(domain)}&type=${type}&do=true`, {
headers: {
Accept: 'application/dns-json',
},
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(`DNS query failed: ${response.statusText} - ${errorText}`);
}
return await response.json();
} catch (err) {
throw new Error(`DoH query failed: ${err instanceof Error ? err.message : 'Unknown error'}`);
}
}
function parseAlgorithm(alg: string | number): number {
if (typeof alg === 'number') return alg;
// Map algorithm names to numbers (RFC 8624)
const algMap: Record<string, number> = {
RSAMD5: 1,
DH: 2,
DSA: 3,
RSASHA1: 5,
'DSA-NSEC3-SHA1': 6,
'RSASHA1-NSEC3-SHA1': 7,
RSASHA256: 8,
RSASHA512: 10,
'ECC-GOST': 12,
ECDSAP256SHA256: 13,
ECDSAP384SHA384: 14,
ED25519: 15,
ED448: 16,
};
return algMap[alg] || 0;
}
async function validateDNSSECChain(domain: string): Promise<DNSSECChainLink[]> {
const chain: DNSSECChainLink[] = [];
const labels = domain.split('.').filter(Boolean);
// Build chain from root to leaf
const zones: string[] = [];
for (let i = labels.length; i >= 0; i--) {
if (i === labels.length) {
zones.push(domain);
} else if (i === 0) {
zones.push('.');
} else {
zones.push(labels.slice(i).join('.'));
}
}
for (let i = 0; i < zones.length; i++) {
const zone = zones[i];
const level = zones.length - i - 1;
const link: DNSSECChainLink = {
name: zone === '.' ? 'Root' : zone,
level,
validated: false,
errors: [],
};
try {
// Query DNSKEY for this zone
const dnskeyResponse = await queryDNS(zone === '.' ? '.' : zone, 'DNSKEY');
if (dnskeyResponse.Answer) {
link.dnskey = dnskeyResponse.Answer.filter((r: DNSRecord) => r.type === 48).map((r: DNSRecord) => {
const parts = r.data.split(' ');
const flags = parseInt(parts[0]);
const protocol = parseInt(parts[1]);
const algorithm = parseAlgorithm(parts[2]);
const publicKey = parts.slice(3).join('');
const isKSK = (flags & 0x0001) === 0x0001; // SEP bit
const isZSK = (flags & 0x0100) === 0x0100;
return {
flags,
protocol,
algorithm,
publicKey,
keyTag: 0, // Will be set during DS matching if applicable
isKSK,
isZSK,
};
});
}
// Query RRSIG for DNSKEY
const rrsigResponse = await queryDNS(zone === '.' ? '.' : zone, 'RRSIG');
if (rrsigResponse.Answer) {
link.rrsig = rrsigResponse.Answer.filter((r: DNSRecord) => r.type === 46)
.filter((r: DNSRecord) => r.data.startsWith('DNSKEY') || r.data.startsWith('48'))
.map((r: DNSRecord) => {
const parts = r.data.split(' ');
return {
typeCovered: parts[0],
algorithm: parseInt(parts[1]),
labels: parseInt(parts[2]),
originalTTL: parseInt(parts[3]),
expiration: parts[4],
inception: parts[5],
keyTag: parseInt(parts[6]),
signerName: parts[7],
signature: parts.slice(8).join(''),
valid: true, // Simplified - proper validation requires crypto
};
});
}
// Query DS records (except for root)
if (zone !== '.') {
const dsResponse = await queryDNS(zone, 'DS');
if (dsResponse.Answer) {
link.ds = dsResponse.Answer.filter((r: DNSRecord) => r.type === 43).map((r: DNSRecord) => {
const parts = r.data.split(' ');
return {
keyTag: parseInt(parts[0]),
algorithm: parseAlgorithm(parts[1]),
digestType: parseInt(parts[2]),
digest: parts.slice(3).join(''),
found: true,
};
});
// Match DS records with DNSKEYs by algorithm
// Since we can't calculate exact key tags from DoH responses,
// we check if there's a KSK with matching algorithm
if (link.ds && link.dnskey) {
link.ds.forEach((ds) => {
const matchingKey = link.dnskey?.find((key) => key.isKSK && key.algorithm === ds.algorithm);
if (matchingKey) {
matchingKey.matched = true;
matchingKey.keyTag = ds.keyTag; // Use DS key tag
link.validated = true;
}
});
}
} else {
link.errors.push('No DS records found');
}
} else {
// Root zone - trust anchor
link.validated = !!(link.dnskey && link.dnskey.length > 0);
}
// Validate RRSIG
if (link.rrsig && link.rrsig.length > 0) {
const now = new Date();
link.rrsig.forEach((sig) => {
const expiration = new Date(parseInt(sig.expiration) * 1000);
const inception = new Date(parseInt(sig.inception) * 1000);
if (now > expiration) {
sig.valid = false;
link.errors.push(`RRSIG expired on ${expiration.toISOString()}`);
} else if (now < inception) {
sig.valid = false;
link.errors.push(`RRSIG not yet valid until ${inception.toISOString()}`);
}
});
}
// Check if chain is complete
if (!link.dnskey || link.dnskey.length === 0) {
link.errors.push('No DNSKEY records found');
link.validated = false;
} else if (zone !== '.' && (!link.ds || link.ds.length === 0)) {
// Non-root zones need DS records to link to parent
link.errors.push('No DS records found');
link.validated = false;
} else if (zone !== '.' && link.ds && link.dnskey) {
// For non-root zones, ensure at least one KSK exists
const hasKSK = link.dnskey.some((key) => key.isKSK);
if (!hasKSK) {
link.errors.push('No KSK (Key Signing Key) found');
link.validated = false;
} else if (!link.validated) {
// If not already validated, check algorithm compatibility
const dsAlgorithms = link.ds.map((ds) => ds.algorithm);
const kskAlgorithms = link.dnskey.filter((k) => k.isKSK).map((k) => k.algorithm);
const hasCompatible = dsAlgorithms.some((alg) => kskAlgorithms.includes(alg));
if (hasCompatible) {
link.validated = true;
} else {
link.errors.push('No DNSKEY with algorithm matching DS records');
link.validated = false;
}
}
}
} catch (err) {
link.errors.push(err instanceof Error ? err.message : 'Unknown error');
link.validated = false;
}
chain.push(link);
}
return chain.reverse(); // Root first, then down to domain
}
export const POST: RequestHandler = async ({ request }) => {
try {
const body: DNSSECValidationRequest = await request.json();
const { domain } = body;
if (!domain || typeof domain !== 'string' || !domain.trim()) {
throw error(400, 'Invalid domain name');
}
const chain = await validateDNSSECChain(domain.trim().toLowerCase());
const isValid = chain.every((link) => link.validated || link.name === 'Root');
const brokenLinks = chain.filter((link) => !link.validated && link.name !== 'Root');
return json({
domain,
valid: isValid,
chain,
brokenLinks,
summary: {
totalLinks: chain.length,
validatedLinks: chain.filter((l) => l.validated).length,
errors: chain.flatMap((l) => l.errors).filter(Boolean),
},
});
} catch (err) {
console.error('DNSSEC validation error:', err);
if (err && typeof err === 'object' && 'status' in err) {
throw err;
}
throw error(500, `DNSSEC validation failed: ${err instanceof Error ? err.message : 'Unknown error'}`);
}
};
@@ -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<string, string> = {};
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<string>();
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}`);
}
@@ -1,8 +1,9 @@
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' | 'ocsp-stapling' | 'cipher-presets';
type Action = 'certificate' | 'versions' | 'alpn' | 'ocsp-stapling' | 'cipher-presets' | 'banner';
interface BaseReq {
action: Action;
@@ -42,7 +43,14 @@ interface CipherPresetsReq extends BaseReq {
port?: number;
}
type RequestBody = CertificateReq | VersionsReq | ALPNReq | OCSPStaplingReq | CipherPresetsReq;
interface BannerReq extends BaseReq {
action: 'banner';
host: string;
port: number;
timeout?: number;
}
type RequestBody = CertificateReq | VersionsReq | ALPNReq | OCSPStaplingReq | CipherPresetsReq | BannerReq;
const TLS_VERSIONS = ['TLSv1', 'TLSv1.1', 'TLSv1.2', 'TLSv1.3'] as const;
@@ -517,6 +525,303 @@ async function testCipherPresets(hostname: string, port: number = 443): Promise<
};
}
async function grabServiceBanner(host: string, port: number, timeout: number = 5000): Promise<any> {
const startTime = Date.now();
return new Promise((resolve, reject) => {
const socket = new net.Socket();
let banner = '';
let protocol = 'unknown';
let hasReceivedData = false;
let completed = false;
// Detect protocol based on port
const protocolMap: { [key: number]: string } = {
13: 'daytime',
21: 'ftp',
22: 'ssh',
23: 'telnet',
25: 'smtp',
43: 'whois',
53: 'dns',
80: 'http',
110: 'pop3',
143: 'imap',
443: 'https',
465: 'smtps',
587: 'submission',
993: 'imaps',
995: 'pop3s',
3306: 'mysql',
5432: 'postgresql',
6379: 'redis',
27017: 'mongodb',
3389: 'rdp',
5900: 'vnc',
};
protocol = protocolMap[port] || 'unknown';
// Hard timeout - always resolve within timeout period
const hardTimeout = setTimeout(() => {
if (!completed) {
completed = true;
socket.destroy();
const responseTime = Date.now() - startTime;
const analysis = analyzeBanner(banner, protocol, port);
resolve({
host,
port,
protocol,
banner: banner.trim(),
responseTime,
connected: true,
hasData: hasReceivedData,
analysis,
timestamp: new Date().toISOString(),
});
}
}, timeout);
socket.setTimeout(timeout);
socket.on('connect', () => {
// Send protocol-specific requests
if (protocol === 'http') {
socket.write(`HEAD / HTTP/1.1\r\nHost: ${host}\r\nConnection: close\r\n\r\n`);
} else if (protocol === 'whois') {
// WHOIS servers need a query to respond - send a test query
socket.write('example.com\r\n');
}
// Set a shorter timer for banner services
setTimeout(() => {
if (!completed) {
completed = true;
clearTimeout(hardTimeout);
socket.destroy();
const responseTime = Date.now() - startTime;
const analysis = analyzeBanner(banner, protocol, port);
resolve({
host,
port,
protocol,
banner: banner.trim(),
responseTime,
connected: true,
hasData: hasReceivedData,
analysis,
timestamp: new Date().toISOString(),
});
}
}, 2000); // 2 second max for banner collection
});
socket.on('data', (data: Uint8Array) => {
hasReceivedData = true;
banner += data.toString();
// For HTTP, close immediately after getting response
if (protocol === 'http' && banner.includes('\r\n\r\n')) {
if (!completed) {
completed = true;
clearTimeout(hardTimeout);
socket.destroy();
const responseTime = Date.now() - startTime;
const analysis = analyzeBanner(banner, protocol, port);
resolve({
host,
port,
protocol,
banner: banner.trim(),
responseTime,
connected: true,
hasData: hasReceivedData,
analysis,
timestamp: new Date().toISOString(),
});
}
}
// For WHOIS, close after getting some response data (they typically respond quickly)
if (protocol === 'whois' && banner.length > 50) {
setTimeout(() => {
if (!completed) {
completed = true;
clearTimeout(hardTimeout);
socket.destroy();
const responseTime = Date.now() - startTime;
const analysis = analyzeBanner(banner, protocol, port);
resolve({
host,
port,
protocol,
banner: banner.trim(),
responseTime,
connected: true,
hasData: hasReceivedData,
analysis,
timestamp: new Date().toISOString(),
});
}
}, 500); // Give it a bit more time to receive the full response
}
});
socket.on('error', (err: Error) => {
if (!completed) {
completed = true;
clearTimeout(hardTimeout);
reject(err);
}
});
socket.on('timeout', () => {
if (!completed) {
completed = true;
clearTimeout(hardTimeout);
socket.destroy();
const responseTime = Date.now() - startTime;
const analysis = analyzeBanner(banner, protocol, port);
resolve({
host,
port,
protocol,
banner: banner.trim(),
responseTime,
connected: true,
hasData: hasReceivedData,
analysis,
timestamp: new Date().toISOString(),
});
}
});
socket.on('close', () => {
if (!completed) {
completed = true;
clearTimeout(hardTimeout);
const responseTime = Date.now() - startTime;
const analysis = analyzeBanner(banner, protocol, port);
resolve({
host,
port,
protocol,
banner: banner.trim(),
responseTime,
connected: true,
hasData: hasReceivedData,
analysis,
timestamp: new Date().toISOString(),
});
}
});
// Start the connection
socket.connect(port, host);
});
}
function analyzeBanner(banner: string, protocol: string, port: number): any {
const analysis: any = {
software: null,
version: null,
os: null,
security: [],
};
if (!banner) return analysis;
const lowerBanner = banner.toLowerCase();
// Software detection patterns
const softwarePatterns = [
{ pattern: /openssh[_\s]+(\d+\.\d+)/i, software: 'OpenSSH' },
{ pattern: /microsoft-iis\/(\d+\.\d+)/i, software: 'Microsoft IIS' },
{ pattern: /apache\/(\d+\.\d+)/i, software: 'Apache HTTP Server' },
{ pattern: /nginx\/(\d+\.\d+)/i, software: 'nginx' },
{ pattern: /postfix/i, software: 'Postfix' },
{ pattern: /exim/i, software: 'Exim' },
{ pattern: /sendmail/i, software: 'Sendmail' },
{ pattern: /mysql[_\s]+(\d+\.\d+)/i, software: 'MySQL' },
{ pattern: /postgresql[_\s]+(\d+\.\d+)/i, software: 'PostgreSQL' },
{ pattern: /redis[_\s]*server[_\s]*v?(\d+\.\d+)/i, software: 'Redis' },
{ pattern: /mongodb[_\s]+(\d+\.\d+)/i, software: 'MongoDB' },
{ pattern: /proftpd[_\s]+(\d+\.\d+)/i, software: 'ProFTPD' },
{ pattern: /vsftpd[_\s]+(\d+\.\d+)/i, software: 'vsftpd' },
{ pattern: /dovecot/i, software: 'Dovecot' },
{ pattern: /courier/i, software: 'Courier' },
];
for (const { pattern, software } of softwarePatterns) {
const match = banner.match(pattern);
if (match) {
analysis.software = software;
if (match[1]) {
analysis.version = match[1];
}
break;
}
}
// OS detection
const osPatterns = [
{ pattern: /ubuntu/i, os: 'Ubuntu Linux' },
{ pattern: /debian/i, os: 'Debian Linux' },
{ pattern: /centos/i, os: 'CentOS Linux' },
{ pattern: /redhat|rhel/i, os: 'Red Hat Linux' },
{ pattern: /windows/i, os: 'Microsoft Windows' },
{ pattern: /freebsd/i, os: 'FreeBSD' },
{ pattern: /openbsd/i, os: 'OpenBSD' },
{ pattern: /linux/i, os: 'Linux' },
];
for (const { pattern, os } of osPatterns) {
if (pattern.test(banner)) {
analysis.os = os;
break;
}
}
// Security analysis
if (protocol === 'ssh') {
if (lowerBanner.includes('openssh')) {
const version = banner.match(/openssh[_\s]+(\d+)\.(\d+)/i);
if (version) {
const major = parseInt(version[1]);
const minor = parseInt(version[2]);
if (major < 8 || (major === 8 && minor < 0)) {
analysis.security.push('Consider upgrading OpenSSH for latest security patches');
}
}
}
if (lowerBanner.includes('protocol 1')) {
analysis.security.push('SSH Protocol 1 detected - upgrade to Protocol 2');
}
}
if (protocol === 'ftp' && port === 21) {
analysis.security.push('Unencrypted FTP - consider using SFTP or FTPS');
}
if (protocol === 'telnet') {
analysis.security.push('Telnet is unencrypted - use SSH instead');
}
if (protocol === 'smtp' && port === 25) {
analysis.security.push('Unencrypted SMTP - consider using STARTTLS or port 587');
}
return analysis;
}
export const POST: RequestHandler = async ({ request }) => {
try {
const body: RequestBody = await request.json();
@@ -577,6 +882,28 @@ export const POST: RequestHandler = async ({ request }) => {
return json({ ...result, hostname, port });
}
case 'banner': {
const { host, port, timeout = 5000 } = body as BannerReq;
// Validate host
if (!host || typeof host !== 'string' || host.trim() === '') {
throw error(400, 'Invalid host provided');
}
// Validate port
if (!port || port < 1 || port > 65535) {
throw error(400, 'Invalid port number (1-65535)');
}
// Validate timeout
if (timeout < 1000 || timeout > 10000) {
throw error(400, 'Invalid timeout (1000-10000ms)');
}
const result = await grabServiceBanner(host, port, timeout);
return json(result);
}
default:
throw error(400, `Unknown action: ${(body as any).action}`);
}
@@ -0,0 +1,786 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let domain = $state('');
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{ domain: 'gov.uk', description: 'UK Government (DNSSEC Enabled)' },
{ domain: 'cloudflare.com', description: 'Cloudflare (DNSSEC Enabled)' },
{ domain: 'dnssec-failed.org', description: 'DNSSEC Failed Test' },
{ domain: 'google.com', description: 'Google (DNSSEC Enabled)' },
{ domain: 'isc.org', description: 'ISC (DNSSEC Pioneer)' },
{ domain: 'ietf.org', description: 'IETF (DNSSEC Enabled)' },
];
const isInputValid = $derived(() => {
const trimmed = domain.trim();
if (!trimmed) return false;
// Basic domain validation
const domainPattern =
/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;
return domainPattern.test(trimmed);
});
async function validateChain() {
if (!isInputValid) {
error = 'Please enter a valid domain name';
return;
}
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/dnssec-validation', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ domain: domain.trim().toLowerCase() }),
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message || 'DNSSEC validation failed');
}
results = data;
} catch (err) {
error = err instanceof Error ? err.message : 'An unexpected error occurred';
} finally {
loading = false;
}
}
function loadExample(example: (typeof examples)[0], index: number) {
domain = example.domain;
selectedExampleIndex = index;
validateChain();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function getAlgorithmName(algo: number): string {
const algorithms: Record<number, string> = {
5: 'RSA/SHA-1',
7: 'RSASHA1-NSEC3-SHA1',
8: 'RSA/SHA-256',
10: 'RSA/SHA-512',
13: 'ECDSA P-256/SHA-256',
14: 'ECDSA P-384/SHA-384',
15: 'Ed25519',
16: 'Ed448',
};
return algorithms[algo] || `Algorithm ${algo}`;
}
function getDigestTypeName(type: number): string {
const types: Record<number, string> = {
1: 'SHA-1',
2: 'SHA-256',
3: 'GOST R 34.11-94',
4: 'SHA-384',
};
return types[type] || `Type ${type}`;
}
</script>
<div class="card">
<header class="card-header">
<h1>DNSSEC Validation Chain Checker</h1>
<p>Validate DNSSEC chain from root to domain, verify DS/DNSKEY matching and RRSIG signatures</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>Quick Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i (i)}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Check DNSSEC for ${example.domain}`}
>
<h5>{example.description}</h5>
<p>{example.domain}</p>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>Domain Name</h3>
</div>
<div class="card-content">
<form
class="inline-form"
onsubmit={(e) => {
e.preventDefault();
validateChain();
}}
>
<div class="form-group flex-grow">
<label for="domain">Domain to Validate</label>
<input
id="domain"
type="text"
bind:value={domain}
placeholder="example.com"
disabled={loading}
onchange={() => clearExampleSelection()}
/>
</div>
<button type="submit" disabled={loading || !isInputValid} class="primary submit-btn">
{#if loading}
<Icon name="loader" size="sm" animate="spin" />
Validating...
{:else}
<Icon name="shield" size="sm" />
Validate DNSSEC Chain
{/if}
</button>
</form>
</div>
</div>
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>Validation Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
{#if loading}
<div class="card">
<div class="card-content">
<div class="loading-state">
<Icon name="loader" size="lg" animate="spin" />
<div class="loading-text">
<h3>Validating DNSSEC Chain</h3>
<p>Querying DNS records from root to {domain}...</p>
</div>
</div>
</div>
</div>
{/if}
{#if results}
<div class="card results-card">
<div class="card-header">
<h3>DNSSEC Validation Results</h3>
</div>
<div class="card-content">
<!-- Summary -->
<div class="card summary-section" class:valid={results.valid} class:invalid={!results.valid}>
<div class="card-header">
<h3>
{#if results.valid}
<Icon name="check-circle" size="sm" />
DNSSEC Valid
{:else}
<Icon name="x-circle" size="sm" />
DNSSEC Invalid
{/if}
</h3>
</div>
<div class="card-content">
<div class="info-grid">
<div class="info-item">
<span class="info-label">Domain:</span>
<span class="info-value">{results.domain}</span>
</div>
<div class="info-item">
<span class="info-label">Chain Links:</span>
<span class="info-value">{results.summary.totalLinks}</span>
</div>
<div class="info-item">
<span class="info-label">Validated:</span>
<span class="info-value">{results.summary.validatedLinks}/{results.summary.totalLinks}</span>
</div>
<div class="info-item">
<span class="info-label">Status:</span>
<span class="info-value" class:success={results.valid} class:error={!results.valid}>
{results.valid ? 'Secure' : 'Broken Chain'}
</span>
</div>
</div>
{#if results.summary.errors.length > 0}
<div class="errors-section">
<h4>Validation Errors:</h4>
<ul>
{#each results.summary.errors as err, i (i)}
<li>{err}</li>
{/each}
</ul>
</div>
{/if}
</div>
</div>
<!-- Chain Links -->
<div class="chain-section">
<div class="card-header">
<h3>DNSSEC Chain</h3>
</div>
<div class="card-content">
<div class="chain-visualization">
{#each results.chain as link, i (i)}
<div class="chain-link" class:validated={link.validated} class:invalid={!link.validated}>
<div class="link-header">
<div class="link-title">
{#if link.validated}
<Icon name="check-circle" size="sm" />
{:else}
<Icon name="alert-circle" size="sm" />
{/if}
<h4>
{link.name}
<span class="level">Level {link.level}</span>
</h4>
</div>
</div>
<div class="link-body">
<!-- DS Records -->
{#if link.ds && link.ds.length > 0}
<div class="record-section">
<h5 use:tooltip={'Delegation Signer records link this zone to the parent zone'}>
<Icon name="key" size="xs" />
DS Records
</h5>
{#each link.ds as ds, j (j)}
<div class="record-item">
<div class="record-details">
<span class="label" use:tooltip={'Identifier for the DNSKEY this DS record refers to'}
>Key Tag:</span
>
<code>{ds.keyTag}</code>
</div>
<div class="record-details">
<span class="label" use:tooltip={'Cryptographic algorithm used for signing'}
>Algorithm:</span
>
<code>{getAlgorithmName(ds.algorithm)}</code>
</div>
<div class="record-details">
<span class="label" use:tooltip={'Hash algorithm used to create the digest'}
>Digest Type:</span
>
<code>{getDigestTypeName(ds.digestType)}</code>
</div>
<div class="record-details">
<span class="label" use:tooltip={'Hash of the DNSKEY record'}>Hash:</span>
<code class="hash">{ds.digest.substring(0, 40)}...</code>
</div>
</div>
{/each}
</div>
{/if}
<!-- DNSKEY Records -->
{#if link.dnskey && link.dnskey.length > 0}
<div class="record-section">
<h5 use:tooltip={'Public keys used to verify DNSSEC signatures'}>
<Icon name="lock" size="xs" />
DNSKEY Records
</h5>
{#each link.dnskey as key, j (j)}
<div class="record-item" class:matched={key.matched}>
<div class="record-details">
<span class="label" use:tooltip={'Identifier for this DNSKEY'}>Key Tag:</span>
<code>{key.keyTag}</code>
{#if key.matched}
<span
class="badge success"
use:tooltip={'This DNSKEY matches a DS record in the parent zone'}>Matched DS</span
>
{/if}
</div>
<div class="record-details">
<span class="label" use:tooltip={'Key properties: 256=ZSK, 257=KSK'}>Flags:</span>
<code>{key.flags}</code>
{#if key.isKSK}
<span class="badge info" use:tooltip={'Key Signing Key - signs other DNSKEYs'}>KSK</span
>
{/if}
{#if key.isZSK}
<span class="badge info" use:tooltip={'Zone Signing Key - signs zone data'}>ZSK</span>
{/if}
</div>
<div class="record-details">
<span class="label" use:tooltip={'Cryptographic algorithm used for signing'}
>Algorithm:</span
>
<code>{getAlgorithmName(key.algorithm)}</code>
</div>
</div>
{/each}
</div>
{/if}
<!-- RRSIG Records -->
{#if link.rrsig && link.rrsig.length > 0}
<div class="record-section">
<h5 use:tooltip={'Digital signatures created with DNSKEY to authenticate DNS data'}>
<Icon name="signature" size="xs" />
RRSIG Records
</h5>
{#each link.rrsig as sig, j (j)}
<div class="record-item" class:valid={sig.valid} class:invalid={!sig.valid}>
<div class="record-details">
<span class="label" use:tooltip={'DNS record type this signature covers'}
>Type Covered:</span
>
<code>{sig.typeCovered}</code>
{#if sig.valid}
<span class="badge success" use:tooltip={'Signature is valid and within time window'}
>Valid</span
>
{:else}
<span class="badge error" use:tooltip={'Signature is expired or not yet valid'}
>Invalid</span
>
{/if}
</div>
<div class="record-details">
<span class="label" use:tooltip={'Identifies which DNSKEY created this signature'}
>Key Tag:</span
>
<code>{sig.keyTag}</code>
</div>
<div class="record-details">
<span class="label" use:tooltip={'Zone that created this signature'}>Signer:</span>
<code>{sig.signerName}</code>
</div>
</div>
{/each}
</div>
{/if}
<!-- Errors -->
{#if link.errors && link.errors.length > 0}
<div class="record-section errors">
<h5>
<Icon name="alert-triangle" size="xs" />
Errors
</h5>
<ul>
{#each link.errors as err, j (j)}
<li>{err}</li>
{/each}
</ul>
</div>
{/if}
</div>
</div>
{#if i < results.chain.length - 1}
<div class="chain-arrow">
<Icon name="arrow-down" size="sm" />
</div>
{/if}
{/each}
</div>
</div>
</div>
</div>
</div>
{/if}
</div>
<style lang="scss">
.results-card {
.card-content {
display: flex;
flex-direction: column;
gap: var(--spacing-md);
.card {
width: 100%;
}
}
}
.summary-section {
&.valid {
border-left: 4px solid var(--color-success);
background: linear-gradient(
135deg,
color-mix(in srgb, var(--color-success), transparent 95%),
color-mix(in srgb, var(--color-success), transparent 98%)
);
}
&.invalid {
border-left: 4px solid var(--color-error);
background: linear-gradient(
135deg,
color-mix(in srgb, var(--color-error), transparent 95%),
color-mix(in srgb, var(--color-error), transparent 98%)
);
}
h3 {
display: flex;
align-items: center;
gap: var(--spacing-xs);
}
}
.info-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--spacing-md);
margin-bottom: var(--spacing-md);
}
.info-item {
display: flex;
flex-direction: column;
gap: var(--spacing-2xs);
}
.info-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.info-value {
font-weight: 600;
color: var(--text-primary);
&.success {
color: var(--color-success);
}
&.error {
color: var(--color-error);
}
}
.errors-section {
h4 {
color: var(--color-error);
margin-bottom: var(--spacing-sm);
}
ul {
list-style: none;
padding: 0;
margin: 0;
li {
padding: var(--spacing-xs) 0;
color: var(--text-secondary);
font-size: var(--font-size-sm);
&::before {
content: '• ';
color: var(--color-error);
}
}
}
}
.chain-visualization {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.chain-link {
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
background: var(--bg-secondary);
overflow: hidden;
&.validated {
border-left: 4px solid var(--color-success);
}
&.invalid {
border-left: 4px solid var(--color-error);
}
}
.link-header {
padding: var(--spacing-md);
background: var(--bg-secondary);
border-bottom: 1px solid var(--border-primary);
}
.link-title {
display: flex;
align-items: center;
gap: var(--spacing-sm);
h4 {
margin: 0;
display: flex;
align-items: center;
gap: var(--spacing-xs);
}
.level {
font-size: var(--font-size-xs);
color: var(--text-secondary);
font-weight: normal;
}
}
.link-body {
padding: var(--spacing-md);
display: flex;
flex-direction: column;
gap: var(--spacing-md);
}
.record-section {
h5 {
display: flex;
align-items: center;
gap: var(--spacing-xs);
margin-bottom: var(--spacing-sm);
color: var(--text-primary);
font-size: var(--font-size-sm);
}
&.errors {
background: var(--bg-tertiary);
padding: var(--spacing-sm);
border-radius: var(--radius-md);
ul {
list-style: none;
padding: 0;
margin: 0;
li {
color: var(--color-error);
font-size: var(--font-size-sm);
padding: var(--spacing-2xs) 0;
&::before {
content: '⚠ ';
}
}
}
}
}
.record-item {
padding: var(--spacing-sm);
background: var(--bg-primary);
border-radius: var(--radius-md);
border: 1px solid var(--border-primary);
margin-bottom: var(--spacing-sm);
&:last-child {
margin-bottom: 0;
}
&.matched {
border-color: var(--color-success);
background: linear-gradient(
135deg,
color-mix(in srgb, var(--color-success), transparent 97%),
color-mix(in srgb, var(--color-success), transparent 99%)
);
}
&.valid {
border-color: color-mix(in srgb, var(--color-success), transparent 60%);
}
&.invalid {
border-color: color-mix(in srgb, var(--color-error), transparent 60%);
}
}
.record-details {
display: flex;
align-items: center;
gap: var(--spacing-xs);
padding: var(--spacing-2xs) 0;
flex-wrap: wrap;
.label {
font-size: var(--font-size-sm);
color: var(--text-secondary);
min-width: 100px;
}
code {
font-family: var(--font-mono);
font-size: var(--font-size-sm);
color: var(--text-primary);
background: var(--bg-tertiary);
padding: 2px 6px;
border-radius: var(--radius-sm);
&.hash {
word-break: break-all;
}
}
}
.badge {
font-size: var(--font-size-xs);
padding: 2px 8px;
border-radius: var(--radius-sm);
font-weight: 500;
&.success {
background: var(--color-success);
color: var(--bg-primary);
}
&.error {
background: var(--color-error);
color: var(--bg-primary);
}
&.info {
background: var(--color-info);
color: var(--bg-primary);
}
}
.chain-arrow {
display: flex;
justify-content: center;
color: var(--text-secondary);
margin: var(--spacing-xs) 0;
}
.inline-form {
display: flex;
gap: var(--spacing-md);
align-items: flex-end;
flex-wrap: wrap;
.form-group {
display: flex;
flex-direction: column;
gap: var(--spacing-2xs);
min-width: 200px;
margin: 0;
&.flex-grow {
flex: 1;
}
label {
font-size: var(--font-size-sm);
color: var(--text-secondary);
font-weight: 500;
}
input {
padding: var(--spacing-sm);
border: 1px solid var(--border-primary);
border-radius: var(--radius-md);
background: var(--bg-primary);
color: var(--text-primary);
font-size: var(--font-size-md);
transition: border-color var(--transition-fast);
&:focus {
outline: none;
border-color: var(--color-primary);
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
}
.submit-btn {
white-space: nowrap;
}
}
// Mobile responsiveness improvements
@media (max-width: 768px) {
.inline-form {
.submit-btn {
width: 100%;
}
}
.info-grid {
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.record-details {
flex-direction: column;
align-items: flex-start;
.label {
min-width: auto;
font-weight: 600;
}
}
.chain-link {
.link-header {
padding: var(--spacing-sm);
}
.link-body {
padding: var(--spacing-sm);
}
}
.record-item {
padding: var(--spacing-xs);
}
}
@media (max-width: 480px) {
.info-grid {
grid-template-columns: 1fr;
}
.badge {
font-size: var(--font-size-2xs);
padding: 1px 6px;
}
.record-details {
code {
font-size: var(--font-size-xs);
word-break: break-all;
}
}
}
</style>
@@ -0,0 +1,490 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let url = $state('https://example.com');
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{ url: 'https://httpbin.org/gzip', description: 'HTTPBin gzip test' },
{ url: 'https://www.google.com', description: 'Google (likely compressed)' },
{ url: 'https://github.com', description: 'GitHub (modern compression)' },
{ url: 'https://www.cloudflare.com', description: 'Cloudflare (brotli support)' },
];
const isInputValid = $derived(() => {
const trimmedUrl = url.trim();
if (!trimmedUrl) return false;
try {
const parsed = new URL(trimmedUrl);
return ['http:', 'https:'].includes(parsed.protocol);
} catch {
return false;
}
});
async function checkCompression() {
if (!isInputValid) {
error = 'Please enter a valid HTTP/HTTPS URL';
return;
}
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/http', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'compression',
url: url.trim(),
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message || 'Failed to check compression');
}
results = data;
} catch (err) {
error = err instanceof Error ? err.message : 'An error occurred';
} finally {
loading = false;
}
}
function loadExample(example: (typeof examples)[0], index: number) {
url = example.url;
selectedExampleIndex = index;
checkCompression();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function formatBytes(bytes: number): string {
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}`;
}
function getCompressionIcon(encoding: string): string {
switch (encoding.toLowerCase()) {
case 'gzip':
return 'archive';
case 'br':
case 'brotli':
return 'zap';
case 'deflate':
return 'compress';
default:
return 'file';
}
}
</script>
<div class="card">
<header class="card-header">
<h1>HTTP Compression Check</h1>
<p>Test gzip, brotli, and deflate compression support and measure size differences</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>Quick Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i (i)}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Test compression for ${example.url}`}
>
<h5>{example.url}</h5>
<p>{example.description}</p>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>URL to Test</h3>
</div>
<div class="card-content">
<div class="form-group">
<label for="url">URL</label>
<div class="input-flex-container">
<input
id="url"
type="url"
bind:value={url}
placeholder="https://example.com"
disabled={loading}
onchange={() => clearExampleSelection()}
onkeydown={(e) => e.key === 'Enter' && checkCompression()}
/>
<button onclick={checkCompression} disabled={loading || !isInputValid} class="primary">
{#if loading}
<Icon name="loader" size="sm" animate="spin" />
Testing...
{:else}
<Icon name="search" size="sm" />
Test Compression
{/if}
</button>
</div>
</div>
</div>
</div>
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>Compression Test Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
{#if loading}
<div class="card">
<div class="card-content">
<div class="loading-state">
<Icon name="loader" size="lg" animate="spin" />
<div class="loading-text">
<h3>Testing Compression</h3>
<p>Checking support for gzip, brotli, and deflate compression...</p>
</div>
</div>
</div>
</div>
{/if}
{#if results}
<div class="card results-card">
<div class="card-header">
<h3>Compression Results</h3>
</div>
<div class="card-content">
<!-- Overview -->
<div class="card overview-section">
<div class="card-header">
<h3>Overview</h3>
</div>
<div class="card-content">
<div class="stats-grid">
<div class="stat-card">
<div class="stat-label">Server Compression</div>
<div class="stat-value" class:success={results.serverCompression.enabled}>
<Icon name={results.serverCompression.enabled ? 'check-circle' : 'x-circle'} size="sm" />
{results.serverCompression.enabled ? 'Enabled' : 'Disabled'}
</div>
{#if results.serverCompression.encoding}
<div class="stat-detail">{results.serverCompression.encoding}</div>
{/if}
</div>
<div class="stat-card">
<div class="stat-label">Best Compression</div>
<div class="stat-value">
<Icon name={getCompressionIcon(results.bestCompression.encoding)} size="sm" />
{results.bestCompression.encoding}
</div>
<div class="stat-detail">{results.bestCompression.ratio.toFixed(1)}% reduction</div>
</div>
<div class="stat-card">
<div class="stat-label">Uncompressed Size</div>
<div class="stat-value">{formatBytes(results.uncompressed.size)}</div>
</div>
<div class="stat-card">
<div class="stat-label">Time Taken</div>
<div class="stat-value">{results.timings.total}ms</div>
</div>
</div>
</div>
</div>
<!-- Compression Methods -->
<div class="card methods-section">
<div class="card-header">
<h3>Compression Methods</h3>
</div>
<div class="card-content">
<div class="compression-grid">
{#each results.compressionResults as result (result.encoding)}
<div class="compression-card" class:best={result.encoding === results.bestCompression.encoding}>
<div class="compression-header">
<div class="compression-type">
<Icon name={getCompressionIcon(result.encoding)} size="sm" />
<span class="encoding-name">{result.encoding}</span>
</div>
<div class="compression-status" class:success={result.supported} class:error={!result.supported}>
<Icon name={result.supported ? 'check' : 'x'} size="xs" />
{result.supported ? 'Supported' : 'Not Supported'}
</div>
</div>
{#if result.supported}
<div class="compression-stats">
<div class="size-comparison">
<div class="size-bar">
<div class="original-bar"></div>
<div
class="compressed-bar"
style="width: {(result.compressedSize / results.uncompressed.size) * 100}%"
></div>
</div>
<div class="size-labels">
<span class="original-size">{formatBytes(results.uncompressed.size)}</span>
<span class="compressed-size">{formatBytes(result.compressedSize)}</span>
</div>
</div>
<div class="compression-metrics">
<div class="metric">
<span class="metric-label">Reduction:</span>
<span class="metric-value">{result.ratio.toFixed(1)}%</span>
</div>
<div class="metric">
<span class="metric-label">Time:</span>
<span class="metric-value">{result.responseTime}ms</span>
</div>
</div>
</div>
{/if}
</div>
{/each}
</div>
</div>
</div>
<!-- Headers -->
<div class="card headers-section">
<div class="card-header">
<h3>Response Headers</h3>
</div>
<div class="card-content">
<div class="headers-grid">
{#each Object.entries(results.headers) as [key, value] (key)}
<div class="header-item">
<span class="header-key">{key}</span>
<span class="header-value">{value}</span>
</div>
{/each}
</div>
</div>
</div>
</div>
</div>
{/if}
</div>
<style lang="scss">
.overview-section,
.methods-section,
.headers-section {
background: var(--bg-secondary);
}
.compression-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: var(--spacing-md);
}
.compression-card {
background: var(--color-surface-elevated);
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
padding: var(--spacing-md);
transition: all var(--transition-normal);
&.best {
border-color: var(--color-success);
background: color-mix(in srgb, var(--color-success), transparent 95%);
}
}
.compression-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--spacing-md);
}
.compression-type {
display: flex;
align-items: center;
gap: var(--spacing-xs);
font-weight: 600;
}
.encoding-name {
text-transform: uppercase;
font-size: var(--font-size-sm);
letter-spacing: 0.5px;
}
.compression-status {
display: flex;
align-items: center;
gap: var(--spacing-2xs);
font-size: var(--font-size-xs);
padding: var(--spacing-2xs) var(--spacing-xs);
border-radius: var(--radius-sm);
&.success {
color: var(--color-success);
background: color-mix(in srgb, var(--color-success), transparent 90%);
}
&.error {
color: var(--color-error);
background: color-mix(in srgb, var(--color-error), transparent 90%);
}
}
.compression-stats {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.size-comparison {
display: flex;
flex-direction: column;
gap: var(--spacing-xs);
}
.size-bar {
position: relative;
height: 8px;
background: var(--bg-secondary);
border-radius: var(--radius-sm);
overflow: hidden;
}
.original-bar {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--color-warning);
opacity: 0.3;
}
.compressed-bar {
position: absolute;
top: 0;
left: 0;
height: 100%;
background: var(--color-success);
transition: width var(--transition-normal);
}
.size-labels {
display: flex;
justify-content: space-between;
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.compression-metrics {
display: flex;
justify-content: space-between;
font-size: var(--font-size-sm);
}
.metric {
display: flex;
flex-direction: column;
gap: var(--spacing-2xs);
}
.metric-label {
color: var(--text-secondary);
font-size: var(--font-size-xs);
}
.metric-value {
font-weight: 600;
color: var(--text-primary);
}
.headers-grid {
display: grid;
gap: var(--spacing-xs);
}
.header-item {
display: grid;
grid-template-columns: 200px 1fr;
gap: var(--spacing-sm);
padding: var(--spacing-xs);
background: var(--color-surface-elevated);
border-radius: var(--radius-sm);
font-size: var(--font-size-sm);
}
.header-key {
font-weight: 600;
color: var(--text-secondary);
word-break: break-word;
}
.header-value {
background: var(--bg-primary);
padding: var(--spacing-xs) var(--spacing-sm);
font-family: var(--font-mono);
border-radius: var(--radius-sm);
word-break: break-all;
}
@media (max-width: 768px) {
.compression-grid {
grid-template-columns: 1fr;
}
.header-item {
grid-template-columns: 1fr;
gap: var(--spacing-2xs);
}
}
.results-card {
.card-content {
display: flex;
flex-direction: column;
gap: var(--spacing-md);
.card {
width: 100%;
}
}
}
</style>
@@ -0,0 +1,737 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let url = $state('https://example.com');
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{ url: 'https://github.com', description: 'Excellent security (Score: 91)' },
{ url: 'https://www.cloudflare.com', description: 'Strong security (Score: 90)' },
{ url: 'https://www.paypal.com', description: 'Good security (Score: 80)' },
{ url: 'https://www.ebay.com', description: 'Many cookies (7 cookies, Score: 67)' },
{ url: 'https://www.nytimes.com', description: 'No HttpOnly flags (Score: 59)' },
{ url: 'https://www.apple.com', description: 'Poor security (1 cookie, Score: 37)' },
{ url: 'https://www.linkedin.com', description: 'Large set (7 cookies, Score: 69)' },
{ url: 'https://domain-locker.com', description: 'No cookies found' },
];
const isInputValid = $derived(() => {
const trimmedUrl = url.trim();
if (!trimmedUrl) return false;
try {
const parsed = new URL(trimmedUrl);
return ['http:', 'https:'].includes(parsed.protocol);
} catch {
return false;
}
});
async function checkCookieSecurity() {
if (!isInputValid) {
error = 'Please enter a valid HTTP/HTTPS URL';
return;
}
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/http', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'cookie-security',
url: url.trim(),
}),
});
const data = await response.json();
if (!response.ok) {
const errorMessage = data.message || 'Failed to check cookie security';
if (errorMessage.includes('Host not found') || errorMessage.includes('ENOTFOUND')) {
throw new Error('Domain not found. Please check the URL and try again.');
} else if (errorMessage.includes('Connection refused') || errorMessage.includes('ECONNREFUSED')) {
throw new Error('Connection refused. The server may be down or unreachable.');
} else if (errorMessage.includes('timeout') || errorMessage.includes('AbortError')) {
throw new Error('Request timed out. The server may be slow to respond.');
}
throw new Error(errorMessage);
}
results = data;
} catch (err) {
if (err instanceof Error) {
error = err.message;
} else {
error = 'An unexpected error occurred. Please try again.';
}
} finally {
loading = false;
}
}
function loadExample(example: (typeof examples)[0], index: number) {
url = example.url;
selectedExampleIndex = index;
checkCookieSecurity();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function getSecurityIcon(level: string): string {
switch (level) {
case 'secure':
return 'shield-check';
case 'warning':
return 'alert-triangle';
case 'error':
return 'shield-x';
default:
return 'help-circle';
}
}
function getSecurityGrade(score: number | null): { grade: string; color: string } {
if (score === null) return { grade: 'N/A', color: 'var(--text-secondary)' };
if (score >= 90) return { grade: 'A+', color: 'var(--color-success)' };
if (score >= 80) return { grade: 'A', color: 'var(--color-success)' };
if (score >= 70) return { grade: 'B', color: 'color-mix(in srgb, var(--color-success), var(--color-warning) 30%)' };
if (score >= 60) return { grade: 'C', color: 'var(--color-warning)' };
if (score >= 50) return { grade: 'D', color: 'color-mix(in srgb, var(--color-warning), var(--color-error) 30%)' };
return { grade: 'F', color: 'var(--color-error)' };
}
function getSameSiteColor(value: string): string {
switch (value.toLowerCase()) {
case 'strict':
return 'var(--color-success)';
case 'lax':
return 'var(--color-warning)';
case 'none':
return 'var(--color-error)';
default:
return 'var(--color-error)';
}
}
</script>
<div class="card">
<header class="card-header">
<h1>HTTP Cookie Security Inspector</h1>
<p>Analyze Set-Cookie headers for Secure, HttpOnly, SameSite, and other security attributes</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>Quick Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i (i)}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Inspect cookies for ${example.url}`}
>
<h5>{example.url}</h5>
<p>{example.description}</p>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>URL to Inspect</h3>
</div>
<div class="card-content">
<div class="form-group">
<label for="url">URL</label>
<div class="input-flex-container">
<input
id="url"
type="url"
bind:value={url}
placeholder="https://example.com"
disabled={loading}
onchange={() => clearExampleSelection()}
onkeydown={(e) => e.key === 'Enter' && checkCookieSecurity()}
/>
<button onclick={checkCookieSecurity} disabled={loading || !isInputValid} class="primary">
{#if loading}
<Icon name="loader" size="sm" animate="spin" />
Analyzing...
{:else}
<Icon name="search" size="sm" />
Inspect Cookies
{/if}
</button>
</div>
</div>
</div>
</div>
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>Cookie Inspection Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
{#if loading}
<div class="card">
<div class="card-content">
<div class="loading-state">
<Icon name="loader" size="lg" animate="spin" />
<div class="loading-text">
<h3>Analyzing Cookies</h3>
<p>Inspecting Set-Cookie headers for security attributes...</p>
</div>
</div>
</div>
</div>
{/if}
{#if results}
<div class="card results-card">
<div class="card-header">
<h3>Cookie Security Analysis</h3>
</div>
<div class="card-content">
<!-- Overall Security Score -->
<div class="card score-section">
<div class="card-header">
<h3>Security Score</h3>
</div>
<div class="card-content">
<div class="score-container">
<div class="score-circle" style="--score-color: {getSecurityGrade(results.securityScore).color}">
<div class="score-value">{getSecurityGrade(results.securityScore).grade}</div>
<div class="score-label">
{results.securityScore !== null ? `${results.securityScore}/100` : 'No cookies'}
</div>
</div>
<div class="score-summary">
<h4>Overall Assessment</h4>
<p>{results.summary}</p>
<div class="score-stats">
<div class="stat">
<span class="stat-label">Total Cookies:</span>
<span class="stat-value">{results.totalCookies}</span>
</div>
<div class="stat">
<span class="stat-label">Secure Cookies:</span>
<span class="stat-value">{results.secureCookies}</span>
</div>
<div class="stat">
<span class="stat-label">HttpOnly Cookies:</span>
<span class="stat-value">{results.httpOnlyCookies}</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Cookie Details -->
{#if results.cookies && results.cookies.length > 0}
<div class="card cookies-section">
<div class="card-header">
<h3>Cookie Details</h3>
</div>
<div class="card-content">
<div class="cookies-grid">
{#each results.cookies as cookie (cookie.id || cookie.name)}
<div
class="cookie-card"
class:secure={cookie.securityLevel === 'secure'}
class:warning={cookie.securityLevel === 'warning'}
class:error={cookie.securityLevel === 'error'}
>
<div class="cookie-header">
<div class="cookie-name">
<Icon name="cookie" size="sm" />
<span class="name">{cookie.name}</span>
</div>
<div
class="cookie-security"
class:secure={cookie.securityLevel === 'secure'}
class:warning={cookie.securityLevel === 'warning'}
class:error={cookie.securityLevel === 'error'}
>
<Icon name={getSecurityIcon(cookie.securityLevel)} size="xs" />
<span class="level">{cookie.securityLevel}</span>
</div>
</div>
<div class="cookie-details">
<div class="cookie-value">
<span class="detail-label">Value:</span>
<span class="detail-value truncated">{cookie.value}</span>
</div>
<div class="security-attributes">
<div class="attribute" class:present={cookie.secure}>
<Icon name={cookie.secure ? 'check' : 'x'} size="xs" />
<span>Secure</span>
</div>
<div class="attribute" class:present={cookie.httpOnly}>
<Icon name={cookie.httpOnly ? 'check' : 'x'} size="xs" />
<span>HttpOnly</span>
</div>
<div
class="attribute samesite"
style="--samesite-color: {getSameSiteColor(cookie.sameSite || 'none')}"
>
<Icon name="shield" size="xs" />
<span>SameSite: {cookie.sameSite || 'None'}</span>
</div>
</div>
{#if cookie.domain || cookie.path || cookie.expires || cookie.maxAge}
<div class="cookie-metadata">
{#if cookie.domain}
<div class="metadata-item">
<span class="metadata-label">Domain:</span>
<span class="metadata-value">{cookie.domain}</span>
</div>
{/if}
{#if cookie.path}
<div class="metadata-item">
<span class="metadata-label">Path:</span>
<span class="metadata-value">{cookie.path}</span>
</div>
{/if}
{#if cookie.expires}
<div class="metadata-item">
<span class="metadata-label">Expires:</span>
<span class="metadata-value">{cookie.expires}</span>
</div>
{/if}
{#if cookie.maxAge}
<div class="metadata-item">
<span class="metadata-label">Max-Age:</span>
<span class="metadata-value">{cookie.maxAge}s</span>
</div>
{/if}
</div>
{/if}
{#if cookie.issues && cookie.issues.length > 0}
<div class="cookie-issues">
<h5>Security Issues:</h5>
<ul>
{#each cookie.issues as issue, issueIndex (issueIndex)}
<li class="issue">
<Icon name="alert-circle" size="xs" />
{issue}
</li>
{/each}
</ul>
</div>
{/if}
</div>
</div>
{/each}
</div>
</div>
</div>
{:else}
<div class="card no-cookies-section">
<div class="card-content">
<div class="no-cookies-message">
<Icon name="cookie" size="lg" />
<h3>No Cookies Found</h3>
<p>The server did not send any Set-Cookie headers in the response.</p>
</div>
</div>
</div>
{/if}
<!-- Security Recommendations -->
{#if results.recommendations && results.recommendations.length > 0}
<div class="card recommendations-section">
<div class="card-header">
<h3>Security Recommendations</h3>
</div>
<div class="card-content">
<div class="recommendations-list">
{#each results.recommendations as recommendation, index (index)}
<div class="recommendation-item">
<Icon name="lightbulb" size="sm" />
<div class="recommendation-content">
<h4>{recommendation.title}</h4>
<p>{recommendation.description}</p>
{#if recommendation.example}
<code class="recommendation-example">{recommendation.example}</code>
{/if}
</div>
</div>
{/each}
</div>
</div>
</div>
{/if}
</div>
</div>
{/if}
</div>
<style lang="scss">
.score-section,
.cookies-section,
.no-cookies-section,
.recommendations-section {
background: var(--bg-secondary);
}
.score-container {
display: flex;
align-items: center;
gap: var(--spacing-lg);
flex-wrap: wrap;
}
.score-circle {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 120px;
height: 120px;
border-radius: 50%;
background: color-mix(in srgb, var(--score-color), transparent 90%);
border: 3px solid var(--score-color);
flex-shrink: 0;
}
.score-value {
font-size: var(--font-size-xl);
font-weight: 700;
color: var(--score-color);
line-height: 1;
}
.score-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
margin-top: var(--spacing-2xs);
}
.score-summary {
flex: 1;
min-width: 250px;
h4 {
margin-bottom: var(--spacing-xs);
color: var(--text-primary);
}
p {
color: var(--text-secondary);
margin-bottom: var(--spacing-sm);
}
}
.score-stats {
display: flex;
gap: var(--spacing-md);
flex-wrap: wrap;
}
.stat {
display: flex;
flex-direction: column;
gap: var(--spacing-2xs);
}
.stat-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.stat-value {
font-weight: 600;
color: var(--text-primary);
}
.cookies-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
gap: var(--spacing-md);
}
.cookie-card {
background: var(--color-surface-elevated);
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
padding: var(--spacing-md);
transition: all var(--transition-normal);
&.secure {
border-color: var(--color-success);
background: color-mix(in srgb, var(--color-success), transparent 95%);
}
&.warning {
border-color: var(--color-warning);
background: color-mix(in srgb, var(--color-warning), transparent 95%);
}
&.error {
border-color: var(--color-error);
background: color-mix(in srgb, var(--color-error), transparent 95%);
}
}
.cookie-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--spacing-md);
}
.cookie-name {
display: flex;
align-items: center;
gap: var(--spacing-xs);
font-weight: 600;
.name {
font-family: var(--font-mono);
color: var(--text-primary);
}
}
.cookie-security {
display: flex;
align-items: center;
gap: var(--spacing-2xs);
font-size: var(--font-size-xs);
padding: var(--spacing-2xs) var(--spacing-xs);
border-radius: var(--radius-sm);
text-transform: uppercase;
font-weight: 600;
&.secure {
color: var(--color-success);
background: color-mix(in srgb, var(--color-success), transparent 90%);
}
&.warning {
color: var(--color-warning);
background: color-mix(in srgb, var(--color-warning), transparent 90%);
}
&.error {
color: var(--color-error);
background: color-mix(in srgb, var(--color-error), transparent 90%);
}
}
.cookie-details {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.cookie-value {
display: flex;
gap: var(--spacing-xs);
font-size: var(--font-size-sm);
.detail-label {
color: var(--text-secondary);
font-weight: 500;
}
.detail-value {
font-family: var(--font-mono);
color: var(--text-primary);
&.truncated {
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.security-attributes {
display: flex;
gap: var(--spacing-sm);
flex-wrap: wrap;
}
.attribute {
display: flex;
align-items: center;
gap: var(--spacing-2xs);
font-size: var(--font-size-xs);
padding: var(--spacing-2xs) var(--spacing-xs);
border-radius: var(--radius-sm);
background: var(--bg-secondary);
color: var(--text-secondary);
&.present {
color: var(--color-success);
background: color-mix(in srgb, var(--color-success), transparent 90%);
}
&.samesite {
color: var(--samesite-color);
background: color-mix(in srgb, var(--samesite-color), transparent 90%);
}
}
.cookie-metadata {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: var(--spacing-xs);
font-size: var(--font-size-xs);
}
.metadata-item {
display: flex;
gap: var(--spacing-xs);
}
.metadata-label {
color: var(--text-secondary);
font-weight: 500;
}
.metadata-value {
font-family: var(--font-mono);
color: var(--text-primary);
}
.cookie-issues {
background: color-mix(in srgb, var(--color-error), transparent 95%);
border: 1px solid color-mix(in srgb, var(--color-error), transparent 80%);
border-radius: var(--radius-sm);
padding: var(--spacing-sm);
h5 {
margin-bottom: var(--spacing-xs);
color: var(--color-error);
font-size: var(--font-size-sm);
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
.issue {
display: flex;
align-items: center;
gap: var(--spacing-xs);
font-size: var(--font-size-xs);
color: var(--color-error);
margin-bottom: var(--spacing-2xs);
&:last-child {
margin-bottom: 0;
}
}
}
.no-cookies-message {
text-align: center;
padding: var(--spacing-xl);
color: var(--text-secondary);
h3 {
margin: var(--spacing-sm) 0;
color: var(--text-primary);
}
}
.recommendations-list {
display: flex;
flex-direction: column;
gap: var(--spacing-md);
}
.recommendation-item {
display: flex;
gap: var(--spacing-sm);
padding: var(--spacing-md);
background: var(--color-surface-elevated);
border-radius: var(--radius-lg);
border: 1px solid var(--border-primary);
}
.recommendation-content {
flex: 1;
h4 {
margin-bottom: var(--spacing-xs);
color: var(--text-primary);
font-size: var(--font-size-sm);
}
p {
color: var(--text-secondary);
font-size: var(--font-size-sm);
margin-bottom: var(--spacing-xs);
}
}
.recommendation-example {
display: block;
padding: var(--spacing-xs);
border-radius: var(--radius-sm);
font-family: var(--font-mono);
font-size: var(--font-size-xs);
color: var(--text-primary);
background: var(--bg-primary);
}
@media (max-width: 768px) {
.cookies-grid {
grid-template-columns: 1fr;
}
.score-container {
flex-direction: column;
text-align: center;
}
.score-stats {
justify-content: center;
}
.security-attributes {
flex-direction: column;
}
.cookie-metadata {
grid-template-columns: 1fr;
}
}
</style>
@@ -0,0 +1,584 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let host = $state('');
let port = $state<number | null>(null);
let service = $state('custom');
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let selectedExampleIndex = $state<number | null>(null);
const services = {
custom: { port: null, description: 'Custom port' },
ssh: { port: 22, description: 'SSH Server' },
smtp: { port: 25, description: 'SMTP Mail Server' },
whois: { port: 43, description: 'WHOIS Service' },
http: { port: 80, description: 'HTTP Web Server' },
https: { port: 443, description: 'HTTPS Web Server' },
ftp: { port: 21, description: 'FTP Server' },
telnet: { port: 23, description: 'Telnet Server' },
pop3: { port: 110, description: 'POP3 Mail Server' },
imap: { port: 143, description: 'IMAP Mail Server' },
smtps: { port: 465, description: 'SMTP over TLS' },
submission: { port: 587, description: 'Mail Submission' },
imaps: { port: 993, description: 'IMAP over TLS' },
pop3s: { port: 995, description: 'POP3 over TLS' },
mysql: { port: 3306, description: 'MySQL Database' },
postgresql: { port: 5432, description: 'PostgreSQL Database' },
redis: { port: 6379, description: 'Redis Database' },
mongodb: { port: 27017, description: 'MongoDB Database' },
rdp: { port: 3389, description: 'Remote Desktop' },
vnc: { port: 5900, description: 'VNC Remote Desktop' },
};
const examples = [
{ host: 'scanme.nmap.org', port: 22, service: 'ssh', description: 'Nmap SSH Test' },
{ host: 'test.rebex.net', port: 21, service: 'ftp', description: 'Rebex FTP Test' },
{ host: 'example.com', port: 80, service: 'http', description: 'Example.com HTTP' },
{ host: 'www.google.com', port: 80, service: 'http', description: 'Google HTTP' },
{ host: 'aspmx.l.google.com', port: 25, service: 'smtp', description: 'Google MX Server' },
{ host: 'whois.iana.org', port: 43, service: 'whois', description: 'IANA WHOIS' },
{ host: 'ftp.freebsd.org', port: 21, service: 'ftp', description: 'FreeBSD FTP' },
{ host: 'httpbin.org', port: 80, service: 'http', description: 'HTTPBin API' },
{ host: 'whois.verisign-grs.com', port: 43, service: 'whois', description: 'Verisign WHOIS' },
];
$effect(() => {
if (service && service !== 'custom' && services[service as keyof typeof services]) {
port = services[service as keyof typeof services].port;
}
});
const isInputValid = $derived(() => {
const trimmedHost = host.trim();
if (!trimmedHost) return false;
if (port === null || port < 1 || port > 65535) return false;
// Basic hostname/IP validation
const hostPattern =
/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$|^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$|^\[?[a-fA-F0-9:]+\]?$/;
return hostPattern.test(trimmedHost);
});
async function grabBanner() {
if (!isInputValid) {
error = 'Please enter a valid host and port (1-65535)';
return;
}
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/tls', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'banner',
host: host.trim(),
port: port,
}),
});
const data = await response.json();
if (!response.ok) {
const errorMessage = data.message || 'Failed to grab banner';
if (errorMessage.includes('ENOTFOUND')) {
throw new Error('Host not found. Please check the hostname and try again.');
} else if (errorMessage.includes('ECONNREFUSED')) {
throw new Error(`Connection refused on port ${port}. The service may be down or port closed.`);
} else if (errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
throw new Error('Connection timed out. The host may be unreachable or port filtered.');
}
throw new Error(errorMessage);
}
results = data;
} catch (err) {
error = err instanceof Error ? err.message : 'An unexpected error occurred';
} finally {
loading = false;
}
}
function loadExample(example: (typeof examples)[0], index: number) {
host = example.host;
port = example.port;
service = example.service;
selectedExampleIndex = index;
grabBanner();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function getProtocolIcon(protocol: string): string {
switch (protocol?.toLowerCase()) {
case 'ssh':
return 'terminal';
case 'http':
case 'https':
return 'globe';
case 'smtp':
case 'smtps':
case 'submission':
return 'mail';
case 'ftp':
return 'folder';
case 'tls':
case 'ssl':
return 'lock';
default:
return 'server';
}
}
function formatBanner(banner: string): string {
// Escape HTML and preserve formatting
return banner
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/\n/g, '<br>')
.replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
}
</script>
<div class="card">
<header class="card-header">
<h1>Service Banner Grabber</h1>
<p>Retrieve service banners from SSH, SMTP, HTTP, FTP, and other network services</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>Quick Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i (i)}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Grab banner from ${example.host}:${example.port}`}
>
<h5>{example.description}</h5>
<p>{example.host}:{example.port}</p>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>Target Service</h3>
</div>
<div class="card-content">
<div class="form-row">
<div class="form-group">
<label for="service">Service Type</label>
<select id="service" bind:value={service} disabled={loading} onchange={() => clearExampleSelection()}>
{#each Object.entries(services) as [key, svc] (key)}
<option value={key}>{svc.description} {svc.port ? `(${svc.port})` : ''}</option>
{/each}
</select>
</div>
</div>
<div class="form-row">
<div class="form-group flex-2">
<label for="host">Host / IP Address</label>
<input
id="host"
type="text"
bind:value={host}
placeholder="example.com or 192.168.1.1"
disabled={loading}
onchange={() => clearExampleSelection()}
onkeydown={(e) => e.key === 'Enter' && grabBanner()}
/>
</div>
<div class="form-group flex-1">
<label for="port">Port</label>
<input
id="port"
type="number"
bind:value={port}
min="1"
max="65535"
placeholder="1-65535"
disabled={loading}
onchange={() => clearExampleSelection()}
onkeydown={(e) => e.key === 'Enter' && grabBanner()}
/>
</div>
</div>
<button onclick={grabBanner} disabled={loading || !isInputValid} class="primary">
{#if loading}
<Icon name="loader" size="sm" animate="spin" />
Connecting...
{:else}
<Icon name="terminal" size="sm" />
Grab Banner
{/if}
</button>
</div>
</div>
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>Connection Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
{#if loading}
<div class="card">
<div class="card-content">
<div class="loading-state">
<Icon name="loader" size="lg" animate="spin" />
<div class="loading-text">
<h3>Grabbing Banner</h3>
<p>Connecting to {host}:{port}...</p>
</div>
</div>
</div>
</div>
{/if}
{#if results}
<div class="card results-card">
<div class="card-header">
<h3>Banner Information</h3>
</div>
<div class="card-content">
<!-- Connection Info -->
<div class="card info-section">
<div class="card-header">
<h3>Connection Details</h3>
</div>
<div class="card-content">
<div class="info-grid">
<div class="info-item">
<span class="info-label">Host:</span>
<span class="info-value">{results.host}</span>
</div>
<div class="info-item">
<span class="info-label">Port:</span>
<span class="info-value">{results.port}</span>
</div>
<div class="info-item">
<span class="info-label">Protocol:</span>
<span class="info-value">
<Icon name={getProtocolIcon(results.protocol)} size="xs" />
{results.protocol || 'Unknown'}
</span>
</div>
<div class="info-item">
<span class="info-label">Response Time:</span>
<span class="info-value">{results.responseTime}ms</span>
</div>
</div>
</div>
</div>
<!-- Banner Content -->
<div class="card banner-section">
<div class="card-header">
<h3>Service Banner</h3>
</div>
<div class="card-content">
{#if results.banner}
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
<pre class="banner-content">{@html formatBanner(results.banner)}</pre>
{:else}
<div class="no-banner">
<Icon name="file-x" size="lg" />
<p>No banner received from service</p>
<small>The service may not send a banner or requires specific protocol handshake</small>
</div>
{/if}
</div>
</div>
<!-- Service Analysis -->
{#if results.analysis && (results.analysis.software || results.analysis.version || results.analysis.os || (results.analysis.security && results.analysis.security.length > 0))}
<div class="card analysis-section">
<div class="card-header">
<h3>Service Analysis</h3>
</div>
<div class="card-content">
<div class="analysis-grid">
{#if results.analysis.software}
<div class="analysis-item">
<Icon name="package" size="sm" />
<div>
<h4>Software</h4>
<p>{results.analysis.software}</p>
</div>
</div>
{/if}
{#if results.analysis.version}
<div class="analysis-item">
<Icon name="tag" size="sm" />
<div>
<h4>Version</h4>
<p>{results.analysis.version}</p>
</div>
</div>
{/if}
{#if results.analysis.os}
<div class="analysis-item">
<Icon name="monitor" size="sm" />
<div>
<h4>Operating System</h4>
<p>{results.analysis.os}</p>
</div>
</div>
{/if}
{#if results.analysis.security && results.analysis.security.length > 0}
<div class="analysis-item full-width">
<Icon name="shield" size="sm" />
<div>
<h4>Security Notes</h4>
<ul>
{#each results.analysis.security as note, i (i)}
<li>{note}</li>
{/each}
</ul>
</div>
</div>
{/if}
</div>
</div>
</div>
{/if}
<!-- TLS Info (if applicable) -->
{#if results.tls}
<div class="card tls-section">
<div class="card-header">
<h3>TLS Information</h3>
</div>
<div class="card-content">
<div class="tls-info">
<div class="tls-item">
<span class="tls-label">Protocol:</span>
<span class="tls-value">{results.tls.protocol}</span>
</div>
<div class="tls-item">
<span class="tls-label">Cipher:</span>
<span class="tls-value">{results.tls.cipher}</span>
</div>
{#if results.tls.certificate}
<div class="tls-item">
<span class="tls-label">Certificate CN:</span>
<span class="tls-value">{results.tls.certificate.cn}</span>
</div>
{/if}
</div>
</div>
</div>
{/if}
</div>
</div>
{/if}
</div>
<style lang="scss">
.results-card {
.card-content {
display: flex;
flex-direction: column;
gap: var(--spacing-md);
.card {
width: 100%;
}
}
}
.info-section,
.banner-section,
.analysis-section,
.tls-section {
background: var(--bg-secondary);
}
.form-row {
display: flex;
gap: var(--spacing-md);
margin-bottom: var(--spacing-md);
@media (max-width: 768px) {
flex-direction: column;
}
}
.flex-1 {
flex: 1;
}
.flex-2 {
flex: 2;
}
.info-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--spacing-md);
}
.info-item {
display: flex;
flex-direction: column;
gap: var(--spacing-2xs);
}
.info-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.info-value {
font-weight: 600;
color: var(--text-primary);
display: flex;
align-items: center;
gap: var(--spacing-xs);
}
.banner-content {
background: var(--bg-primary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-md);
padding: var(--spacing-md);
font-family: var(--font-mono);
font-size: var(--font-size-sm);
line-height: 1.6;
overflow-x: auto;
max-height: 400px;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
}
.no-banner {
text-align: center;
padding: var(--spacing-xl);
color: var(--text-secondary);
p {
margin: var(--spacing-sm) 0;
font-weight: 500;
}
small {
font-size: var(--font-size-xs);
opacity: 0.8;
}
}
.analysis-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: var(--spacing-md);
}
.analysis-item {
display: flex;
gap: var(--spacing-sm);
padding: var(--spacing-md);
background: var(--color-surface-elevated);
border-radius: var(--radius-lg);
border: 1px solid var(--border-primary);
&.full-width {
grid-column: 1 / -1;
}
h4 {
font-size: var(--font-size-sm);
margin-bottom: var(--spacing-xs);
color: var(--text-primary);
}
p {
font-family: var(--font-mono);
color: var(--text-secondary);
font-size: var(--font-size-sm);
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
li {
font-size: var(--font-size-sm);
color: var(--text-secondary);
padding: var(--spacing-2xs) 0;
}
}
.tls-info {
display: grid;
gap: var(--spacing-sm);
}
.tls-item {
display: grid;
grid-template-columns: 150px 1fr;
gap: var(--spacing-sm);
padding: var(--spacing-xs);
background: var(--color-surface-elevated);
border-radius: var(--radius-sm);
}
.tls-label {
font-weight: 600;
color: var(--text-secondary);
font-size: var(--font-size-sm);
}
.tls-value {
font-family: var(--font-mono);
color: var(--text-primary);
font-size: var(--font-size-sm);
word-break: break-all;
}
select {
width: 100%;
padding: var(--spacing-sm);
border: 1px solid var(--border-primary);
border-radius: var(--radius-md);
background: var(--bg-primary);
color: var(--text-primary);
font-size: var(--font-size-base);
cursor: pointer;
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
</style>
+7 -5
View File
@@ -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;
+16 -1
View File
@@ -1,11 +1,13 @@
<script lang="ts">
import { TOP_NAV, aboutPages, SUB_NAV, STANDALONE_PAGES, type NavItem, type NavGroup } from '$lib/constants/nav';
import { resolve } from '$app/paths';
import Icon from '$lib/components/global/Icon.svelte';
interface TreeNode {
label: string;
href: string | null;
description?: string;
icon?: string;
children: TreeNode[];
}
@@ -13,6 +15,7 @@
label: 'label' in item ? item.label : item.title,
href: 'href' in item ? item.href : null,
description: item.description,
icon: 'icon' in item ? item.icon : undefined,
children: [],
});
@@ -64,6 +67,9 @@
{@const title = node.description || node.label}
{@const ariaLabel = node.description ? `${node.label}: ${node.description}` : node.label}
{#if node.href}
{#if node.icon}
<Icon name={node.icon} size="xs" />
{/if}
<a href={node.href} {title} aria-label={ariaLabel}>{node.label}</a>
{:else}
<span class={node.children.length ? 'section-title' : 'group-title'} {title} aria-label={ariaLabel}>
@@ -154,6 +160,15 @@
li {
margin: var(--spacing-xs) 0;
padding-left: var(--spacing-sm);
:global(.icon) {
opacity: 0.75;
transition: all ease-in-out 0.2s;
}
&:hover > :global(.icon) {
opacity: 1;
transform: scale(1.1);
}
}
}
}
@@ -161,7 +176,7 @@
a {
color: var(--color-link);
text-decoration: none;
padding: 0 var(--spacing-sm);
// padding: 0 var(--spacing-sm);
display: inline-block;
transition: all 0.2s;
border-radius: var(--radius-sm);
+1 -1
View File
@@ -18,9 +18,9 @@ section:not(.row) {
}
h3 {
margin-bottom: var(--spacing-sm);
opacity: 0.8;
font-size: var(--font-size-md);
margin: var(--spacing-md) 0 var(--spacing-sm) 0;
}
a {
+1 -1
View File
@@ -250,7 +250,7 @@
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js"></script>
<script>
SwaggerUIBundle({
url: "https://raw.githubusercontent.com/Lissy93/networking-toolbox/refs/heads/main/swagger.yaml?token=GHSAT0AAAAAAC4DRTQMEKVRUYJKMDSKHFHE2GXWK6Q",
url: "https://raw.githubusercontent.com/Lissy93/networking-toolbox/refs/heads/main/swagger.yaml",
dom_id: "#swagger",
deepLinking: true,
presets: [SwaggerUIBundle.presets.apis],
+6 -2
View File
@@ -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;
}
}
}
+1 -1
View File
@@ -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');
});