add password challenge

This commit is contained in:
lesion 2018-08-26 23:43:06 +02:00
parent a418c4e86c
commit 3e9b76fb66
No known key found for this signature in database
GPG Key ID: 352918250B012177
2 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,5 @@
const express = require('express') const express = require('express')
const router = express.Router() const router = express.Router()
const { fromTor, fromVpn, checkCountry } = require('./utils') const { fromTor, fromVpn, checkCountry } = require('./utils')
// magic // magic
@ -18,6 +17,10 @@ router.get('/metadata', render('metadata'))
// level IV (mail -> vpn) // level IV (mail -> vpn)
router.get('/mail', render('mail')) router.get('/mail', render('mail'))
router.get('/password', render('password'))
router.get('/fingerprint', render('fingerprint'))
// level V (vpn -> read mail) // level V (vpn -> read mail)
router.get('/vpn', fromTor, fromVpn, checkCountry, (req, res, next) => { router.get('/vpn', fromTor, fromVpn, checkCountry, (req, res, next) => {
if (!req.fromTor && req.fromVpn) { if (!req.fromTor && req.fromVpn) {
@ -27,6 +30,5 @@ router.get('/vpn', fromTor, fromVpn, checkCountry, (req, res, next) => {
} }
}) })
router.get('/password', render('password'))
module.exports = router module.exports = router

View File

@ -9,13 +9,14 @@ block content
li Tr0ub4dour&3 li Tr0ub4dour&3
br br
#app(v-cloak) #app(v-cloak)
input( form(action='/vpn')
type='password', input(
v-model='password', type='password',
@input='checkStrength' v-model='password',
:class="['score' + estimationScore]" @input='checkStrength'
) :class="['score' + estimationScore]"
button(:disabled="estimationScore!==4") ➜ )
button(:disabled="estimationScore!==4") ➜
p(v-if='password.length>2'). p(v-if='password.length>2').
Questa password è {{score[estimationScore]}}, dopo un sequestro uno bravo Questa password è {{score[estimationScore]}}, dopo un sequestro uno bravo
ci mette più o meno <b>{{slowCrackTime}}</b> a scoprirla, ci mette più o meno <b>{{slowCrackTime}}</b> a scoprirla,
@ -53,11 +54,11 @@ block content
}, },
methods: { methods: {
checkStrength (e) { checkStrength (e) {
var estimation = zxcvbn(this.password) var estimation = zxcvbn(this.password, ['diocane', 'dioporco', 'porcodio', 'madonnacane'])
this.estimationScore = estimation.score; this.estimationScore = estimation.score;
this.slowCrackTime = moment.duration(estimation.crack_times_seconds.offline_slow_hashing_1e4_per_second, 'seconds').humanize(); this.slowCrackTime = moment.duration(estimation.crack_times_seconds.offline_slow_hashing_1e4_per_second, 'seconds').humanize();
this.fastCrackTime = moment.duration(estimation.crack_times_seconds.offline_fast_hashing_1e10_per_second, 'seconds').humanize(); this.fastCrackTime = moment.duration(estimation.crack_times_seconds.offline_fast_hashing_1e10_per_second, 'seconds').humanize();
this.sequence = estimation.sequence; this.sequence = estimation.sequence;
} },
} }
}) })