better password level

This commit is contained in:
lesion 2018-08-12 00:01:09 +02:00
parent 97b3f8a830
commit 2fb330fa9b
No known key found for this signature in database
GPG Key ID: 352918250B012177
4 changed files with 100 additions and 23 deletions

1
public/js/moment.js Normal file

File diff suppressed because one or more lines are too long

6
public/js/vue.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -36,3 +36,42 @@ code {
background-color: black; background-color: black;
width: 100%; width: 100%;
} }
input {
height: 20px;
margin: 10px;
padding: 5px;
width: 300px;
transition: border-color .8s, background-color .8s;
color: black;
}
.score0 {
background-color: #ff222288;
border: 2px solid red;
}
.score1 {
background-color: #ff5716cc;
border: 2px solid #ff6644;
}
.score2 {
background-color: #ff9955;
border: 2px solid #ffcc88;
}
.score3 {
background-color: #0067FF;
border: 2px solid #6496ff;
}
.score4 {
background-color: #33dd33;
border: 2px solid #99FF00;
}
button {
cursor: pointer;
height: 34px;
}

View File

@ -3,30 +3,61 @@ extends layout
block content block content
p. p.
Bla bla bla qui devi scegliere una buona password Bla bla bla qui devi scegliere una buona password
cosa puoi provare:
input#password(type="password", name="password") li cia0Antaniqwer10102018
p#crackTime li Tr0ub4dour&3
p#feedback br
p#sequence #app
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>:
a#vinto(style="visibility: hidden") vinto 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/zxcvbn.js") script(src='/js/vue.min.js')
script(src='/js/zxcvbn.js')
script(src='/js/moment.js')
script. script.
var crackTime = document.getElementById('crackTime') moment.locale('it');
var feedback = document.getElementById('feedback') var app = new Vue({
var sequence = document.getElementById('sequence') el: '#app',
var vinto = document.getElementById('vinto') data: {
password: '',
document.getElementById('password').oninput = function(ev, t) { estimationScore: 0,
var ret = zxcvbn(this.value) score: ['inutile', 'pessima', 'brutta', 'così così', 'buona'],
console.log(ret) scoreColor: 'red',
crackTime.innerHTML = 'A craccarla ci metto circa ' + ret.crack_times_display.offline_slow_hashing_1e4_per_second; slowCrackTime: '',
feedback.innerHTML = ret.feedback.suggestions.join(', ') fastCrackTime: '',
sequence.innerHTML = ret.sequence.map(s => s.pattern).join(' ,') sequence: [],
if (ret.score === 4){ },
vinto.style.visibility = 'visible'; methods: {
} else { checkStrength (e) {
vinto.style.visibility = 'hidden'; var estimation = zxcvbn(this.password)
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;
} }
} }
})