mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-23 22:31:10 +03:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c45a055643 | ||
|
|
11206a52a1 | ||
|
|
068d79a08f | ||
|
|
df049e2e69 | ||
|
|
743757761d | ||
|
|
12b0dc100d | ||
|
|
d14371c5c2 | ||
|
|
00b85de1a0 | ||
|
|
4598ebae09 |
No files matched your search
Vendored
+8
-2
@@ -109,7 +109,6 @@ declare module '@vue/runtime-core' {
|
||||
JsonDiff: typeof import('./src/tools/json-diff/json-diff.vue')['default']
|
||||
JsonMinify: typeof import('./src/tools/json-minify/json-minify.vue')['default']
|
||||
JsonToCsv: typeof import('./src/tools/json-to-csv/json-to-csv.vue')['default']
|
||||
JsonToPhpArray: typeof import('./src/tools/json-to-php-array/json-to-php-array.vue')['default']
|
||||
JsonToToml: typeof import('./src/tools/json-to-toml/json-to-toml.vue')['default']
|
||||
JsonToYaml: typeof import('./src/tools/json-to-yaml-converter/json-to-yaml.vue')['default']
|
||||
JsonViewer: typeof import('./src/tools/json-viewer/json-viewer.vue')['default']
|
||||
@@ -118,6 +117,7 @@ declare module '@vue/runtime-core' {
|
||||
ListConverter: typeof import('./src/tools/list-converter/list-converter.vue')['default']
|
||||
LocaleSelector: typeof import('./src/modules/i18n/components/locale-selector.vue')['default']
|
||||
LoremIpsumGenerator: typeof import('./src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue')['default']
|
||||
MacAddressConverter: typeof import('./src/tools/mac-address-converter/mac-address-converter.vue')['default']
|
||||
MacAddressGenerator: typeof import('./src/tools/mac-address-generator/mac-address-generator.vue')['default']
|
||||
MacAddressLookup: typeof import('./src/tools/mac-address-lookup/mac-address-lookup.vue')['default']
|
||||
MathEvaluator: typeof import('./src/tools/math-evaluator/math-evaluator.vue')['default']
|
||||
@@ -131,14 +131,21 @@ declare module '@vue/runtime-core' {
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NGi: typeof import('naive-ui')['NGi']
|
||||
NGrid: typeof import('naive-ui')['NGrid']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
NLabel: typeof import('naive-ui')['NLabel']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
@@ -146,7 +153,6 @@ declare module '@vue/runtime-core' {
|
||||
PdfSignatureDetails: typeof import('./src/tools/pdf-signature-checker/components/pdf-signature-details.vue')['default']
|
||||
PercentageCalculator: typeof import('./src/tools/percentage-calculator/percentage-calculator.vue')['default']
|
||||
PhoneParserAndFormatter: typeof import('./src/tools/phone-parser-and-formatter/phone-parser-and-formatter.vue')['default']
|
||||
PhpArrayToJson: typeof import('./src/tools/php-array-to-json/php-array-to-json.vue')['default']
|
||||
QrCodeGenerator: typeof import('./src/tools/qr-code-generator/qr-code-generator.vue')['default']
|
||||
RandomPortGenerator: typeof import('./src/tools/random-port-generator/random-port-generator.vue')['default']
|
||||
ResultRow: typeof import('./src/tools/ipv4-range-expander/result-row.vue')['default']
|
||||
|
||||
+2
-3
@@ -65,7 +65,6 @@
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"json5": "^2.2.3",
|
||||
"jsonar-mod": "^1.9.0",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
"lodash": "^4.17.21",
|
||||
@@ -87,7 +86,6 @@
|
||||
"unicode-emoji-json": "^0.4.0",
|
||||
"unplugin-auto-import": "^0.16.4",
|
||||
"uuid": "^9.0.0",
|
||||
"vite-plugin-node-polyfills": "^0.21.0",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.9.1",
|
||||
"vue-router": "^4.1.6",
|
||||
@@ -139,5 +137,6 @@
|
||||
"vitest": "^0.34.0",
|
||||
"workbox-window": "^7.0.0",
|
||||
"zx": "^7.2.1"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@8.15.3"
|
||||
}
|
||||
Generated
+88
-662
File diff suppressed because it is too large.
Load diff
+10
-7
@@ -1,11 +1,8 @@
|
||||
import { tool as base64FileConverter } from './base64-file-converter';
|
||||
import { tool as base64StringConverter } from './base64-string-converter';
|
||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||
import { tool as jsonToPhpArray } from './json-to-php-array';
|
||||
import { tool as phpArrayToJson } from './php-array-to-json';
|
||||
|
||||
import { tool as macAddressConverter } from './mac-address-converter';
|
||||
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 pdfSignatureChecker } from './pdf-signature-checker';
|
||||
@@ -130,8 +127,6 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
httpStatusCodes,
|
||||
jsonDiff,
|
||||
safelinkDecoder,
|
||||
jsonToPhpArray,
|
||||
phpArrayToJson,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -156,7 +151,15 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
},
|
||||
{
|
||||
name: 'Network',
|
||||
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
|
||||
components: [
|
||||
ipv4SubnetCalculator,
|
||||
ipv4AddressConverter,
|
||||
ipv4RangeExpander,
|
||||
macAddressLookup,
|
||||
macAddressGenerator,
|
||||
macAddressConverter,
|
||||
ipv6UlaGenerator,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Math',
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { BrandPhp } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Json to PHP-Array',
|
||||
path: '/json-to-php-array',
|
||||
description: 'Convert JSON to PHP Array',
|
||||
keywords: ['json', 'php', 'array'],
|
||||
component: () => import('./json-to-php-array.vue'),
|
||||
icon: BrandPhp,
|
||||
createdAt: new Date('2024-05-11'),
|
||||
});
|
||||
@@ -1,36 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import jsonar from 'jsonar-mod';
|
||||
import JSON5 from 'json5';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
|
||||
const defaultValue = `{
|
||||
a:"b",
|
||||
arr: [1, "2"],
|
||||
nested: {
|
||||
c:12,
|
||||
d: "az"
|
||||
}
|
||||
}`;
|
||||
function transformer(value: string) {
|
||||
return withDefaultOnError(() => jsonar.arrify(JSON5.parse(value), { prettify: true }), '');
|
||||
}
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (v: string) => JSON5.parse(v),
|
||||
message: 'Provided JSON is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<format-transformer
|
||||
input-label="Your JSON"
|
||||
:input-default="defaultValue"
|
||||
input-placeholder="Paste your JSON here..."
|
||||
output-label="PHP Array version"
|
||||
:input-validation-rules="rules"
|
||||
:transformer="transformer"
|
||||
/>
|
||||
</template>
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
declare module 'jsonar-mod' {
|
||||
export function arrify(json: any, options?: { prettify?: boolean}): string
|
||||
export function parse(php: string): object
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Devices } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'MAC Address Converter',
|
||||
path: '/mac-address-converter',
|
||||
description: 'Change the format of a MAC address and chose between different formats (EUI-48, EUI-64, IPv6)',
|
||||
keywords: [
|
||||
'converter',
|
||||
'mac',
|
||||
'address',
|
||||
'format',
|
||||
'link-local',
|
||||
'ipv6',
|
||||
'eui-48',
|
||||
'eui-64',
|
||||
],
|
||||
component: () => import('./mac-address-converter.vue'),
|
||||
icon: Devices,
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
convertMacCISCO, convertMacCanonical,
|
||||
convertMacCanonicalIEEE, convertMacCanonicalIETF,
|
||||
convertMacToEUI64CISCO, convertMacToEUI64CanonicalIEEE,
|
||||
convertMacToEUI64CanonicalIETF, convertMacToLinkLocalIPv6,
|
||||
convertMacToNumber,
|
||||
} from './mac-address-converter.service';
|
||||
|
||||
describe('mac-address-converter', () => {
|
||||
it('Convert MAC Address to given format', async () => {
|
||||
expect(convertMacCanonical('')).to.equal('');
|
||||
|
||||
const macValue = '00:0a:95:9d:68:16';
|
||||
|
||||
expect(convertMacCanonicalIETF(macValue)).to.equal('00:0a:95:9d:68:16');
|
||||
expect(convertMacCanonical(macValue)).to.equal('00.0a.95.9d.68.16');
|
||||
expect(convertMacCanonicalIEEE(macValue)).to.equal('00-0A-95-9D-68-16');
|
||||
expect(convertMacCISCO(macValue)).to.equal('000a.959d.6816');
|
||||
|
||||
expect(convertMacToEUI64CanonicalIETF(macValue, true)).to.equal('02:0a:95:ff:fe:9d:68:16'); // NOSONAR
|
||||
expect(convertMacToEUI64CanonicalIETF(macValue, false)).to.equal('00:0a:95:ff:fe:9d:68:16'); // NOSONAR
|
||||
expect(convertMacToEUI64CanonicalIEEE(macValue, true)).to.equal('02-0A-95-FF-FE-9D-68-16');
|
||||
expect(convertMacToEUI64CanonicalIEEE(macValue, false)).to.equal('00-0A-95-FF-FE-9D-68-16');
|
||||
expect(convertMacToEUI64CISCO(macValue, true)).to.equal('020a.95ff.fe9d.6816');
|
||||
expect(convertMacToEUI64CISCO(macValue, false)).to.equal('000a.95ff.fe9d.6816');
|
||||
expect(convertMacToNumber(macValue)).to.equal(45459793942);
|
||||
expect(convertMacToLinkLocalIPv6(macValue)).to.equal(':fe80::20a:95ff:fe9d:6816');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
function convertMac(mac: string, group: number = 2, char: string = ':'): string {
|
||||
mac = mac.replace(/[\W_]+/g, '');
|
||||
return mac.match(new RegExp(`.{1,${group}}`, 'g'))?.join(char) || '';
|
||||
}
|
||||
|
||||
function convertMacToEUI64(mac: string, ipv6: boolean) {
|
||||
const macIETF = convertMac(mac);
|
||||
// Split the MAC address into an array of hex values
|
||||
const macArray = macIETF.split(':').map(hex => Number.parseInt(hex, 16));
|
||||
|
||||
// For IPv6, invert the 7th bit of the first byte
|
||||
if (ipv6) {
|
||||
macArray[0] ^= 0x02;
|
||||
}
|
||||
|
||||
// Insert FFFE in the middle
|
||||
const eui64Array = [
|
||||
macArray[0], macArray[1], macArray[2],
|
||||
0xFF, 0xFE,
|
||||
macArray[3], macArray[4], macArray[5],
|
||||
];
|
||||
|
||||
// Convert the array to a colon-separated string
|
||||
const eui64 = eui64Array.map(byte => byte.toString(16).padStart(2, '0')).join(':');
|
||||
|
||||
// Group into IPv6 EUI-64 format (XXXX:XXFF:FEXX:XXXX)
|
||||
return eui64.replace(/:/g, '').match(/.{1,4}/g)!.join(':');
|
||||
}
|
||||
|
||||
export function convertMacToEUI64CanonicalIETF(mac: string, ipv6: boolean) {
|
||||
return convertMac(convertMacToEUI64(mac, ipv6).toLocaleLowerCase());
|
||||
}
|
||||
export function convertMacToEUI64CanonicalIEEE(mac: string, ipv6: boolean) {
|
||||
return convertMac(convertMacToEUI64(mac, ipv6).toLocaleUpperCase(), 2, '-');
|
||||
}
|
||||
export function convertMacToEUI64CISCO(mac: string, ipv6: boolean) {
|
||||
return convertMac(convertMacToEUI64(mac, ipv6).toLocaleLowerCase(), 4, '.');
|
||||
}
|
||||
export function convertMacToLinkLocalIPv6(mac: string) {
|
||||
return `:fe80::${convertMac(convertMacToEUI64(mac, true).toLocaleLowerCase(), 4, ':').replace(/^0/g, '')}`;
|
||||
}
|
||||
|
||||
export function convertMacToNumber(mac: string) {
|
||||
mac = mac.replace(/[\W_]+/g, '');
|
||||
return Number.parseInt(mac, 16);
|
||||
}
|
||||
|
||||
export function convertMacCanonicalIETF(mac: string): string {
|
||||
return convertMac(mac.toLocaleLowerCase());
|
||||
};
|
||||
export function convertMacCanonical(mac: string): string {
|
||||
return convertMac(mac, 2, '.');
|
||||
};
|
||||
export function convertMacCanonicalIEEE(mac: string): string {
|
||||
return convertMac(mac.toLocaleUpperCase(), 2, '-');
|
||||
};
|
||||
export function convertMacCISCO(mac: string): string {
|
||||
return convertMac(mac.toLocaleLowerCase(), 4, '.');
|
||||
};
|
||||
@@ -0,0 +1,101 @@
|
||||
<script setup lang="ts">
|
||||
import InputCopyable from '../../components/InputCopyable.vue';
|
||||
import {
|
||||
convertMacCISCO, convertMacCanonical,
|
||||
convertMacCanonicalIEEE, convertMacCanonicalIETF,
|
||||
convertMacToEUI64CISCO, convertMacToEUI64CanonicalIEEE,
|
||||
convertMacToEUI64CanonicalIETF, convertMacToLinkLocalIPv6,
|
||||
convertMacToNumber,
|
||||
} from './mac-address-converter.service';
|
||||
|
||||
const input = ref('AA:BB:CC:DD:EE:FF');
|
||||
|
||||
const formats = computed(() => [
|
||||
{
|
||||
label: 'Canonical IETF Format:',
|
||||
value: convertMacCanonicalIETF(input.value),
|
||||
},
|
||||
{
|
||||
label: 'Canonical Format:',
|
||||
value: convertMacCanonical(input.value),
|
||||
},
|
||||
{
|
||||
label: 'Canonical IEEE Format:',
|
||||
value: convertMacCanonicalIEEE(input.value),
|
||||
},
|
||||
{
|
||||
label: 'Cisco:',
|
||||
value: convertMacCISCO(input.value),
|
||||
},
|
||||
{
|
||||
label: 'Hex:',
|
||||
value: convertMacToNumber(input.value).toString(16),
|
||||
},
|
||||
{
|
||||
label: 'Decimal:',
|
||||
value: convertMacToNumber(input.value).toString(10),
|
||||
},
|
||||
{
|
||||
label: 'EUI-64 Canonical IETF Format:',
|
||||
value: convertMacToEUI64CanonicalIETF(input.value, false),
|
||||
},
|
||||
{
|
||||
label: 'EUI-64 Canonical IEEE Format:',
|
||||
value: convertMacToEUI64CanonicalIEEE(input.value, false),
|
||||
},
|
||||
{
|
||||
label: 'EUI-64 Cisco:',
|
||||
value: convertMacToEUI64CISCO(input.value, false),
|
||||
},
|
||||
{
|
||||
label: 'EUI-64 IPv6 Canonical IETF Format:',
|
||||
value: convertMacToEUI64CanonicalIETF(input.value, true),
|
||||
},
|
||||
{
|
||||
label: 'EUI-64 IPv6 Canonical IEEE Format:',
|
||||
value: convertMacToEUI64CanonicalIEEE(input.value, true),
|
||||
},
|
||||
{
|
||||
label: 'EUI-64 IPv6 Cisco:',
|
||||
value: convertMacToEUI64CISCO(input.value, true),
|
||||
},
|
||||
{
|
||||
label: 'Link-Local IPv6:',
|
||||
value: convertMacToLinkLocalIPv6(input.value),
|
||||
},
|
||||
]);
|
||||
|
||||
const inputLabelAlignmentConfig = {
|
||||
labelPosition: 'left',
|
||||
labelWidth: '120px',
|
||||
labelAlign: 'right',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<c-card>
|
||||
<c-input-text
|
||||
v-model:value="input"
|
||||
label="MAC address:"
|
||||
size="large"
|
||||
placeholder="Type a MAC address"
|
||||
clearable
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
mb-5
|
||||
/>
|
||||
|
||||
<div my-16px divider />
|
||||
|
||||
<InputCopyable
|
||||
v-for="format in formats"
|
||||
:key="format.label"
|
||||
:value="format.value"
|
||||
:label="format.label"
|
||||
v-bind="inputLabelAlignmentConfig"
|
||||
mb-1
|
||||
/>
|
||||
</c-card>
|
||||
</template>
|
||||
@@ -1,12 +0,0 @@
|
||||
import { BrandPhp } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'PHP-Array to JSON',
|
||||
path: '/php-array-to-json',
|
||||
description: 'Convert PHP Array to JSON',
|
||||
keywords: ['php', 'array', 'json'],
|
||||
component: () => import('./php-array-to-json.vue'),
|
||||
icon: BrandPhp,
|
||||
createdAt: new Date('2024-05-11'),
|
||||
});
|
||||
@@ -1,39 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import jsonar from 'jsonar-mod';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
|
||||
const defaultValue = `array(
|
||||
"a" => "b",
|
||||
"arr" => array(
|
||||
1,
|
||||
"2"
|
||||
),
|
||||
"nested" => array(
|
||||
"c" => 12,
|
||||
"d" => "az"
|
||||
)
|
||||
);`;
|
||||
function transformer(value: string) {
|
||||
return withDefaultOnError(() => JSON.stringify(jsonar.parse(value), null, 2), '');
|
||||
}
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (v: string) => v === '' || jsonar.parse(v),
|
||||
message: 'Provided PHP Array is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<format-transformer
|
||||
input-label="Your PHP Array"
|
||||
:input-default="defaultValue"
|
||||
input-placeholder="Paste your PHP Array here..."
|
||||
output-label="JSON version"
|
||||
output-language="json"
|
||||
:input-validation-rules="rules"
|
||||
:transformer="transformer"
|
||||
/>
|
||||
</template>
|
||||
@@ -1,6 +1,5 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { URL, fileURLToPath } from 'node:url';
|
||||
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||
|
||||
import VueI18n from '@intlify/unplugin-vue-i18n/vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
@@ -98,7 +97,6 @@ export default defineConfig({
|
||||
resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
|
||||
}),
|
||||
Unocss(),
|
||||
nodePolyfills(),
|
||||
],
|
||||
base: baseUrl,
|
||||
resolve: {
|
||||
|
||||
Reference in new issue
Block a user