feat(new tool): Port Info Search

FIx #568
This commit is contained in:
sharevb 2024-05-01 14:39:09 +02:00 committed by ShareVB
parent cb5b462e11
commit b36a01e77a
6 changed files with 78 additions and 7 deletions

View file

@ -6,6 +6,7 @@ import { tool as asciiTextDrawer } from './ascii-text-drawer';
import { tool as textToUnicode } from './text-to-unicode';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as portNumbers } from './port-numbers';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@ -152,7 +153,15 @@ export const toolsByCategory: ToolCategory[] = [
},
{
name: 'Network',
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
components: [
ipv4SubnetCalculator,
ipv4AddressConverter,
ipv4RangeExpander,
macAddressLookup,
macAddressGenerator,
ipv6UlaGenerator,
portNumbers,
],
},
{
name: 'Math',

View file

@ -0,0 +1,12 @@
import { PlugConnected } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Port Numbers',
path: '/port-numbers',
description: 'Search for assigned usage of a given port and protocol',
keywords: ['port', 'tcp', 'udp', 'protocol'],
component: () => import('./port-numbers.vue'),
icon: PlugConnected,
createdAt: new Date('2024-04-20'),
});

View file

@ -0,0 +1,38 @@
<script setup lang="ts">
import ports from 'port-numbers';
import SpanCopyable from '@/components/SpanCopyable.vue';
const port = ref(80);
const protocol = ref('tcp');
const result = computed(() => {
const [type, description] = ports[`${port.value}/${protocol.value}` as (keyof typeof ports)];
return { type: type ?? 'unknown', description: description ?? 'Unknown' };
});
</script>
<template>
<div>
<c-card title="Port search">
<n-space>
<n-form-item label="Port number">
<n-input-number v-model:value="port" :min="1" />
</n-form-item>
<n-form-item label="Protocol">
<c-select
v-model:value="protocol"
:options="[{ value: 'tcp', label: 'TCP' }, { value: 'udp', label: 'UDP' }]"
/>
</n-form-item>
</n-space>
</c-card>
<c-card>
<n-form-item label="Type">
<SpanCopyable :value="result?.type" />
</n-form-item>
<n-form-item label="Description">
<SpanCopyable :value="result?.description" />
</n-form-item>
</c-card>
</div>
</template>