mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-25 07:04:39 +03:00
Merge branch 'feat/wpa-psk-generator' into chore/all-my-stuffs
# Conflicts: # components.d.ts # src/tools/index.ts
This commit is contained in:
commit
11f1fd6a79
6 files changed
+102
-2
No files matched your search
Generated
-2
@@ -10644,7 +10644,6 @@ packages:
|
|||||||
/jsesc@2.5.2:
|
/jsesc@2.5.2:
|
||||||
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
|
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
hasBin: true
|
|
||||||
|
|
||||||
/jsesc@3.0.2:
|
/jsesc@3.0.2:
|
||||||
resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==}
|
resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==}
|
||||||
@@ -15859,7 +15858,6 @@ packages:
|
|||||||
|
|
||||||
/yamljs@0.3.0:
|
/yamljs@0.3.0:
|
||||||
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
|
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
dependencies:
|
||||||
argparse: 1.0.10
|
argparse: 1.0.10
|
||||||
glob: 7.2.3
|
glob: 7.2.3
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import { tool as unicodeSearch } from './unicode-search';
|
|||||||
import { tool as vatValidator } from './vat-validator';
|
import { tool as vatValidator } from './vat-validator';
|
||||||
import { tool as websocketTester } from './websocket-tester';
|
import { tool as websocketTester } from './websocket-tester';
|
||||||
import { tool as weekNumberConverter } from './week-number-converter';
|
import { tool as weekNumberConverter } from './week-number-converter';
|
||||||
|
import { tool as wpaPskGenerator } from './wpa-psk-generator';
|
||||||
|
|
||||||
import { tool as cssXpathConverter } from './css-xpath-converter';
|
import { tool as cssXpathConverter } from './css-xpath-converter';
|
||||||
import { tool as cssSelectorsMemo } from './css-selectors-memo';
|
import { tool as cssSelectorsMemo } from './css-selectors-memo';
|
||||||
@@ -223,6 +224,9 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
pdfSignatureChecker,
|
pdfSignatureChecker,
|
||||||
// pgpEncryption,
|
// pgpEncryption,
|
||||||
rsaEcdsaSigning,
|
rsaEcdsaSigning,
|
||||||
|
passwordStrengthAnalyser,
|
||||||
|
pdfSignatureChecker,
|
||||||
|
wpaPskGenerator,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { Wifi } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'WPA PSK generator',
|
||||||
|
path: '/wpa-psk-generator',
|
||||||
|
description: 'WPA Pre-shared Key Generator to convert a WPA passphrase and SSID to the 256-bit pre-shared ("raw") key',
|
||||||
|
keywords: ['wpa', 'psk', 'pre', 'shared', 'key', 'ssid', 'passphrase', 'generator'],
|
||||||
|
component: () => import('./wpa-psk-generator.vue'),
|
||||||
|
icon: Wifi,
|
||||||
|
createdAt: new Date('2024-08-15'),
|
||||||
|
});
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { generateWpaPskRawKey } from './wpa-psk-generator.service';
|
||||||
|
|
||||||
|
describe('wpa-psk-generator', () => {
|
||||||
|
it('generateWpaPskRawKey should generate raw key', () => {
|
||||||
|
expect(generateWpaPskRawKey('test', 'test')).to.deep.eq({
|
||||||
|
passphrase: 'test',
|
||||||
|
psk: 'd630c5513becfd3952432bd7fcf098b7a40907f3214cf43551f1b8cfda873ecc',
|
||||||
|
ssid: 'test',
|
||||||
|
});
|
||||||
|
expect(generateWpaPskRawKey('test', 'test')?.psk).toHaveLength(256 / 8 * 2);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import CryptoJS from 'crypto-js';
|
||||||
|
import pbkdf2 from 'crypto-js/pbkdf2';
|
||||||
|
|
||||||
|
export function generateWpaPskRawKey(ssid: string, passphrase: string) {
|
||||||
|
const psk = pbkdf2(passphrase, ssid, {
|
||||||
|
keySize: 256 / 32,
|
||||||
|
iterations: 4096,
|
||||||
|
hasher: CryptoJS.algo.SHA1,
|
||||||
|
}).toString(CryptoJS.enc.Hex);
|
||||||
|
return {
|
||||||
|
ssid,
|
||||||
|
passphrase,
|
||||||
|
psk,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { generateWpaPskRawKey } from './wpa-psk-generator.service';
|
||||||
|
import { useValidation } from '@/composable/validation';
|
||||||
|
|
||||||
|
const ssid = ref('');
|
||||||
|
const passphrase = ref('');
|
||||||
|
|
||||||
|
const wpaPSKRawKey = ref('');
|
||||||
|
function computeRawKey() {
|
||||||
|
try {
|
||||||
|
wpaPSKRawKey.value = generateWpaPskRawKey(ssid.value, passphrase.value)?.psk;
|
||||||
|
}
|
||||||
|
catch (e: any) {
|
||||||
|
wpaPSKRawKey.value = e.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ssidValidation = useValidation({
|
||||||
|
source: ssid,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
validator: v => v !== '',
|
||||||
|
message: 'SSID must not be empty.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div style="max-width: 600px;">
|
||||||
|
<c-card title="Wifi Infos" mb-2>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="ssid"
|
||||||
|
label="SSID"
|
||||||
|
label-position="left"
|
||||||
|
placeholder="Put your SSID here..."
|
||||||
|
:validation="ssidValidation"
|
||||||
|
mb-2
|
||||||
|
/>
|
||||||
|
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="passphrase"
|
||||||
|
label="Passphrase"
|
||||||
|
label-position="left"
|
||||||
|
placeholder="Put your Passphrase here..."
|
||||||
|
mb-2
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div flex justify-center>
|
||||||
|
<n-button @click="computeRawKey()">Compute</n-button>
|
||||||
|
</div>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<c-card title="WPA PSK Raw Key (256 bits)">
|
||||||
|
<TextareaCopyable :value="wpaPSKRawKey" />
|
||||||
|
</c-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Reference in new issue
Block a user