fugadalcontrollo/views/password.pug
2018-08-26 23:43:06 +02:00

64 lines
No EOL
2.4 KiB
Text

extends layout
block content
p.
Bla bla bla qui devi scegliere una buona password
cosa puoi provare:
li cia0Antaniqwer10102018
li Tr0ub4dour&3
br
#app(v-cloak)
form(action='/vpn')
input(
type='password',
v-model='password',
@input='checkStrength'
:class="['score' + estimationScore]"
)
button(:disabled="estimationScore!==4") ➜
p(v-if='password.length>2').
Questa password è {{score[estimationScore]}}, dopo un sequestro uno bravo
ci mette più o meno <b>{{slowCrackTime}}</b> a scoprirla,
la CIA circa <b>{{fastCrackTime}}</b>:
li(v-for="s in sequence")
span(v-if="s.pattern=='bruteforce'") {{s.token}} forza bruta
span(v-else-if="s.pattern=='dictionary'").
{{s.token}} dizionario: {{s.dictionary_name}}
{{s.reversed?'(invertita ' + s.matched_word + ')':''}}
{{s.l33t?'(con sostituzione ' + s.sub_display +')':''}}
{{s.uppercase_variations>1?'(con maiuscola)':''}}
span(v-else-if="s.pattern=='sequence'") {{s.token}} sequenze: ({{s.sequence_name}})
span(v-else-if="s.pattern=='spatial'") {{s.token}} sequenze spaziali: ({{s.graph}})
span(v-else-if="s.pattern=='repeat'") {{s.token}} ripetizione: ({{s.base_token}})
span(v-else-if="s.pattern=='date'") {{s.token}} data {{s.day}}/{{s.month}}/{{s.year}}
span(v-else-if="s.pattern=='regex'") {{s.token}} pattern {{s.regex_name}}
span(v-else) {{s}}
script(src='/js/vue.min.js')
script(src='/js/zxcvbn.js')
script(src='/js/moment.js')
script.
moment.locale('it');
var app = new Vue({
el: '#app',
data: {
password: '',
estimationScore: 0,
score: ['inutile', 'pessima', 'brutta', 'così così', 'buona'],
scoreColor: 'red',
slowCrackTime: '',
fastCrackTime: '',
sequence: [],
},
methods: {
checkStrength (e) {
var estimation = zxcvbn(this.password, ['diocane', 'dioporco', 'porcodio', 'madonnacane'])
this.estimationScore = estimation.score;
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.sequence = estimation.sequence;
},
}
})