Compare commits

...
Author SHA1 Message Date
sharevb 97544530c9 Merge branch 'main' into feat/htpasswd 2024-04-14 20:28:32 +02:00
ShareVB 0de51a2dea chore(github workflows): ci and e2e tests: try updating to node 20 2024-04-14 20:27:30 +02:00
sharevb 3b7b0a45e6 feat(htpasswd generator): allow salt rounds input (if bcrypt) 2024-04-14 14:43:40 +02:00
sharevbandCorentin THOMASSET d3b32cc14e feat(new tool): Outlook Safelink Decoder (#911)
* feat(new tool): Outlook Safelink Decoder

Fix #897

* Use native URL parsing

Co-authored-by: Corentin THOMASSET <corentin.thomasset74@gmail.com>

* Update src/tools/safelink-decoder/index.ts

---------

Co-authored-by: Corentin THOMASSET <corentin.thomasset74@gmail.com>
2024-03-11 10:19:32 +00:00
sharevb 3a0b612239 feat(new tool): htpasswd generator
Fix #430 and #807
2024-02-25 14:19:09 +01:00
ShareVB e073b2babf chore: fix deps 2024-02-18 12:01:33 +01:00
sharevb 83832f3e2c feat(TextareaCopyable): word-wrap prop
Add word-wrap property (to allow presenting long public keys)
2024-02-18 11:39:13 +01:00
sharevb ee40ba1439 chore: prepare sshpk for cert/key/sshkeys related tools 2024-02-18 11:39:13 +01:00
sharevb 3f32990499 chore: prepare sshpk for cert/key/sshkeys related tools 2024-02-18 11:38:29 +01:00
14 changed files with 805 additions and 16 deletions

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'
- name: Install dependencies
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'
- name: Get Playwright version
+4
View File
@@ -47,6 +47,7 @@
"@vueuse/core": "^10.3.0",
"@vueuse/head": "^1.0.0",
"@vueuse/router": "^10.0.0",
"apache-md5": "^1.1.8",
"bcryptjs": "^2.4.3",
"change-case": "^4.1.2",
"colord": "^2.9.3",
@@ -81,6 +82,7 @@
"plausible-tracker": "^0.3.8",
"qrcode": "^1.5.1",
"sql-formatter": "^13.0.0",
"sshpk": "^1.18.0",
"ua-parser-js": "^1.0.35",
"ulid": "^2.3.0",
"unicode-emoji-json": "^0.4.0",
@@ -110,6 +112,7 @@
"@types/node": "^18.15.11",
"@types/node-forge": "^1.3.2",
"@types/qrcode": "^1.5.0",
"@types/sshpk": "^1.17.4",
"@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^9.0.0",
"@unocss/eslint-config": "^0.57.0",
@@ -131,6 +134,7 @@
"unplugin-icons": "^0.17.0",
"unplugin-vue-components": "^0.25.0",
"vite": "^4.4.9",
"vite-plugin-node-polyfills": "^0.21.0",
"vite-plugin-pwa": "^0.16.0",
"vite-plugin-vue-markdown": "^0.23.5",
"vite-svg-loader": "^4.0.0",
+2 -2
View File
@@ -9,7 +9,7 @@ const useWebServer = process.env.NO_WEB_SERVER !== 'true';
*/
export default defineConfig({
testDir: './src',
testMatch: /.*\.e2e\.(spec\.)?ts/,
testMatch: /\.e2e\.(spec\.)?ts$/,
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -57,7 +57,7 @@ export default defineConfig({
&& {
webServer: {
command: 'npm run preview',
url: 'http://127.0.0.1:5050',
url: 'http://localhost:5050',
reuseExistingServer: !isCI,
},
}
+645 -10
View File
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -16,6 +16,7 @@ const props = withDefaults(
language?: string
copyPlacement?: 'top-right' | 'bottom-right' | 'outside' | 'none'
copyMessage?: string
wordWrap?: boolean
}>(),
{
followHeightOf: null,
@@ -47,7 +48,7 @@ const tooltipText = computed(() => isJustCopied.value ? 'Copied!' : copyMessage.
:style="height ? `min-height: ${height - 40 /* card padding */ + 10 /* negative margin compensation */}px` : ''"
>
<n-config-provider :hljs="hljs">
<n-code :code="value" :language="language" :trim="false" data-test-id="area-content" />
<n-code :code="value" :language="language" :word-wrap="wordWrap" :trim="false" data-test-id="area-content" />
</n-config-provider>
</n-scrollbar>
<div absolute right-10px top-10px>
@@ -0,0 +1,60 @@
<script setup lang="ts">
import { hashSync } from 'bcryptjs';
import md5 from 'apache-md5';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const username = ref('');
const password = ref('');
const hashMethod = ref('bcrypt');
const saltCount = ref(10);
const htpasswd = computed(() => {
if (username.value === '' || password.value === '') {
return '# username and password must not be empty';
}
let hash;
if (hashMethod.value === 'md5') {
hash = md5(password.value);
}
else {
hash = hashSync(password.value, saltCount.value);
}
return `${username.value}:${hash}`;
});
</script>
<template>
<div>
<c-input-text
v-model:value="username"
label="Username"
placeholder="Your username..."
clearable raw-text mb-5
/>
<c-input-text
v-model:value="password"
label="Password"
placeholder="Your password..."
clearable
raw-text
mb-2
type="password"
/>
<c-select
v-model:value="hashMethod"
label="Hash method:"
:options="['bcrypt', 'md5']"
/>
<n-form-item v-if="hashMethod === 'bcrypt'" label="Salt count: " label-placement="left" label-width="120">
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="100" :min="0" w-full />
</n-form-item>
<n-divider />
<n-form-item label="htpasswd content:">
<TextareaCopyable :value="htpasswd" />
</n-form-item>
</div>
</template>
+12
View File
@@ -0,0 +1,12 @@
import { PasswordRound } from '@vicons/material';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Htpasswd/htaccess generator',
path: '/htpasswd-generator',
description: 'htpassword/htaccess user/password generator',
keywords: ['htpasswd', 'htaccess', 'bcrypt', 'password'],
component: () => import('./htpasswd-generator.vue'),
icon: PasswordRound,
createdAt: new Date('2024-02-20'),
});
+4 -1
View File
@@ -5,7 +5,8 @@ import { tool as basicAuthGenerator } from './basic-auth-generator';
import { tool as asciiTextDrawer } from './ascii-text-drawer';
import { tool as textToUnicode } from './text-to-unicode';
import { tool as htpasswdGenerator } from './htpasswd-generator';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -117,6 +118,7 @@ export const toolsByCategory: ToolCategory[] = [
urlParser,
deviceInformation,
basicAuthGenerator,
htpasswdGenerator,
metaTagGenerator,
otpCodeGeneratorAndValidator,
mimeTypes,
@@ -127,6 +129,7 @@ export const toolsByCategory: ToolCategory[] = [
userAgentParser,
httpStatusCodes,
jsonDiff,
safelinkDecoder,
],
},
{
+12
View File
@@ -0,0 +1,12 @@
import { Mailbox } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Outlook Safelink decoder',
path: '/safelink-decoder',
description: 'Decode Outlook SafeLink links',
keywords: ['outlook', 'safelink', 'decoder'],
component: () => import('./safelink-decoder.vue'),
icon: Mailbox,
createdAt: new Date('2024-03-11'),
});
@@ -0,0 +1,21 @@
import { describe, expect, it } from 'vitest';
import { decodeSafeLinksURL } from './safelink-decoder.service';
describe('safelink-decoder', () => {
describe('decodeSafeLinksURL', () => {
describe('decode outlook safelink urls', () => {
it('should decode basic safelink urls', () => {
expect(decodeSafeLinksURL('https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dsafelink%26rlz%3D1&data=05%7C02%7C%7C1ed07253975b46da1d1508dc3443752a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638442711583216725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2BQY0HBnnxfI7pzZoxzlhZdDvYu80LwQB0zUUjrffVnk%3D&reserved=0'))
.toBe('https://www.google.com/search?q=safelink&rlz=1');
});
it('should decode encoded safelink urls', () => {
expect(decodeSafeLinksURL('https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dsafelink%26rlz%3D1&amp;data=05%7C02%7C%7C1ed07253975b46da1d1508dc3443752a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638442711583216725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;sdata=%2BQY0HBnnxfI7pzZoxzlhZdDvYu80LwQB0zUUjrffVnk%3D&amp;reserved=0'))
.toBe('https://www.google.com/search?q=safelink&rlz=1');
});
it('throw on not outlook safelink urls', () => {
expect(() => decodeSafeLinksURL('https://google.com'))
.toThrow('Invalid SafeLinks URL provided');
});
});
});
});
@@ -0,0 +1,7 @@
export function decodeSafeLinksURL(safeLinksUrl: string) {
if (!safeLinksUrl.match(/\.safelinks\.protection\.outlook\.com/)) {
throw new Error('Invalid SafeLinks URL provided');
}
return new URL(safeLinksUrl).searchParams.get('url');
}
@@ -0,0 +1,32 @@
<script setup lang="ts">
import { decodeSafeLinksURL } from './safelink-decoder.service';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const inputSafeLinkUrl = ref('');
const outputDecodedUrl = computed(() => {
try {
return decodeSafeLinksURL(inputSafeLinkUrl.value);
}
catch (e: any) {
return e.toString();
}
});
</script>
<template>
<div>
<c-input-text
v-model:value="inputSafeLinkUrl"
raw-text
placeholder="Your input Outlook SafeLink Url..."
autofocus
label="Your input Outlook SafeLink Url:"
/>
<n-divider />
<n-form-item label="Output decoded URL:">
<TextareaCopyable :value="outputDecodedUrl" :word-wrap="true" />
</n-form-item>
</div>
</template>
+2
View File
@@ -1,5 +1,6 @@
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';
@@ -97,6 +98,7 @@ export default defineConfig({
resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
}),
Unocss(),
nodePolyfills(),
],
base: baseUrl,
resolve: {