Skip to content

Commit

Permalink
test pages
Browse files Browse the repository at this point in the history
  • Loading branch information
fb0sh committed Nov 12, 2024
1 parent 48f6917 commit fbdce9f
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 61 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"node-forge": "^1.3.1",
"roboto-fontface": "*",
"vue": "^3.4.31",
"vue-router": "^4.4.5",
"vuetify": "^3.7.4"
},
"devDependencies": {
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<template>
<v-app>
<v-main>
<Jwt />
</v-main>
</v-app>
<router-view></router-view>
</template>

<script setup lang="ts">
Expand Down
14 changes: 8 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
*/

// Plugins
import { registerPlugins } from '@/plugins'
import { registerPlugins } from "@/plugins";

// Components
import App from './App.vue'
import App from "./App.vue";

// Composables
import { createApp } from 'vue'
import { createApp } from "vue";
import router from "./router";

const app = createApp(App)
const app = createApp(App);

registerPlugins(app)
registerPlugins(app);
app.use(router);

app.mount('#app')
app.mount("#app");
39 changes: 39 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
{ path: "/", component: () => import("../views/Jwt.vue") },
{
path: "/jku",
beforeEnter: (to, from, next) => {

Check failure on line 7 in src/router/index.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'to' implicitly has an 'any' type.

Check failure on line 7 in src/router/index.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'from' implicitly has an 'any' type.

Check failure on line 7 in src/router/index.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'next' implicitly has an 'any' type.
console.log("jku");
const jsonResponse = {
name: "John Doe",
age: 30,
country: "USA",
};

// 将 JSON 数据直接写入到页面,避免 HTML 渲染
document.body.innerHTML = `<pre>${JSON.stringify(
jsonResponse,
null,
2
)}</pre>`;

// 直接结束路由导航,不继续渲染组件
next(false);
next(false);
},
component: () => import("../views/Jwt.vue"),
},
{
path: "/:catchAll(.*)",
component: () => import("../views/Notfound.vue"),
},
];

const router = createRouter({
history: createWebHashHistory(),
routes,
});

export default router;
106 changes: 56 additions & 50 deletions src/components/Jwt.vue → src/views/Jwt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -315,59 +315,65 @@ onMounted(async () => {
})
</script>
<template>
<div class="d-flex justify-center">
<div class="d-flex flex-column w-75">
<v-app>
<v-main>


<div class="d-flex justify-center">
<div class="d-flex flex-column w-75">

<div class="d-flex justify-space-between mt-10">

<v-btn @mousedown="(event: MouseEvent) => {
if (event.button === 0) {
decodeJwt()
} else if (event.button === 1) {
clearJwt()
}
}" variant="text">
<h1>JWT-ALL</h1>
</v-btn>

<p>Click <b>JWT-ALL</b> to decode jwt! Middle to Clear!</p>


<div class="w-33"></div>
<v-text-field class="mr-4" v-model="jwt_secret_key" label="Secret Key" variant="outlined"
@blur="encodeJwt"></v-text-field>
<v-select width="100px" label="Alg" v-model="selected_alg" :items=algs variant="outlined"
@vue:mounted="select_alg" @update:model-value="select_alg"></v-select>
</div>

<div>
<v-textarea rows="5" label="S-JWT" variant="outlined" no-resize v-model="sjwt"></v-textarea>
<div class="d-flex">
<v-textarea rows="10" class="mr-2" label="Header" variant="outlined" no-resize
v-model="header" @blur="encodeJwt"></v-textarea>
<v-textarea rows="10" class="mr-2" label="Payload" variant="outlined" no-resize
v-model="payload" @blur="encodeJwt"></v-textarea>
<v-textarea rows="10" label="Verify Signature" variant="outlined" no-resize
v-model="signature_type" readonly></v-textarea>
</div>
</div>


<v-textarea rows="5" label="T-JWT" variant="outlined" no-resize v-model="tjwt"></v-textarea>
<div class="d-flex">
<v-btn @click="none_attack">None</v-btn>
<v-btn class="ml-4" @click="no_sign_attack">No Sign</v-btn>
<v-btn class="ml-4" @click="brute_force_attack">Brute</v-btn>
<v-btn class="ml-4" @click="jwk_injection_attack">JWK IJ</v-btn>
<v-btn class="ml-4" @click="jku_injection_attack">JKU IJ</v-btn>
<v-btn class="ml-4">KID PATH</v-btn>
</div>
<p class="mt-4">Dictionary: <a
href="https://github.com/wallarm/jwt-secrets">https://github.com/wallarm/jwt-secrets</a></p>

<div class="d-flex justify-space-between mt-10">

<v-btn @mousedown="(event: MouseEvent) => {
if (event.button === 0) {
decodeJwt()
} else if (event.button === 1) {
clearJwt()
}
}" variant="text">
<h1>JWT-ALL</h1>
</v-btn>

<p>Click <b>JWT-ALL</b> to decode jwt! Middle to Clear!</p>


<div class="w-33"></div>
<v-text-field class="mr-4" v-model="jwt_secret_key" label="Secret Key" variant="outlined"
@blur="encodeJwt"></v-text-field>
<v-select width="100px" label="Alg" v-model="selected_alg" :items=algs variant="outlined"
@vue:mounted="select_alg" @update:model-value="select_alg"></v-select>
</div>

<div>
<v-textarea rows="5" label="S-JWT" variant="outlined" no-resize v-model="sjwt"></v-textarea>
<div class="d-flex">
<v-textarea rows="10" class="mr-2" label="Header" variant="outlined" no-resize v-model="header"
@blur="encodeJwt"></v-textarea>
<v-textarea rows="10" class="mr-2" label="Payload" variant="outlined" no-resize v-model="payload"
@blur="encodeJwt"></v-textarea>
<v-textarea rows="10" label="Verify Signature" variant="outlined" no-resize v-model="signature_type"
readonly></v-textarea>
</div>
</div>


<v-textarea rows="5" label="T-JWT" variant="outlined" no-resize v-model="tjwt"></v-textarea>
<div class="d-flex">
<v-btn @click="none_attack">None</v-btn>
<v-btn class="ml-4" @click="no_sign_attack">No Sign</v-btn>
<v-btn class="ml-4" @click="brute_force_attack">Brute</v-btn>
<v-btn class="ml-4" @click="jwk_injection_attack">JWK IJ</v-btn>
<v-btn class="ml-4" @click="jku_injection_attack">JKU IJ</v-btn>
<v-btn class="ml-4">KID PATH</v-btn>
</div>
<p class="mt-4">Dictionary: <a
href="https://github.com/wallarm/jwt-secrets">https://github.com/wallarm/jwt-secrets</a></p>

</div>


</div>
</v-main>
</v-app>
</template>
11 changes: 11 additions & 0 deletions src/views/NotFound.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div>
Not Found
</div>
</template>

<script setup lang="ts">
</script>

<style scoped></style>

0 comments on commit fbdce9f

Please sign in to comment.