password.pug 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. extends layout
  2. block content
  3. p.
  4. Bla bla bla qui devi scegliere una buona password
  5. cosa puoi provare:
  6. li cia0Antaniqwer10102018
  7. li Tr0ub4dour&3
  8. br
  9. #app(v-cloak)
  10. form(action='/vpn')
  11. input(
  12. type='password',
  13. v-model='password',
  14. @input='checkStrength'
  15. :class="['score' + estimationScore]"
  16. )
  17. button(:disabled="estimationScore!==4") ➜
  18. p(v-if='password.length>2').
  19. Questa password è {{score[estimationScore]}}, dopo un sequestro uno bravo
  20. ci mette più o meno <b>{{slowCrackTime}}</b> a scoprirla,
  21. la CIA circa <b>{{fastCrackTime}}</b>:
  22. li(v-for="s in sequence")
  23. span(v-if="s.pattern=='bruteforce'") {{s.token}} forza bruta
  24. span(v-else-if="s.pattern=='dictionary'").
  25. {{s.token}} dizionario: {{s.dictionary_name}}
  26. {{s.reversed?'(invertita ' + s.matched_word + ')':''}}
  27. {{s.l33t?'(con sostituzione ' + s.sub_display +')':''}}
  28. {{s.uppercase_variations>1?'(con maiuscola)':''}}
  29. span(v-else-if="s.pattern=='sequence'") {{s.token}} sequenze: ({{s.sequence_name}})
  30. span(v-else-if="s.pattern=='spatial'") {{s.token}} sequenze spaziali: ({{s.graph}})
  31. span(v-else-if="s.pattern=='repeat'") {{s.token}} ripetizione: ({{s.base_token}})
  32. span(v-else-if="s.pattern=='date'") {{s.token}} data {{s.day}}/{{s.month}}/{{s.year}}
  33. span(v-else-if="s.pattern=='regex'") {{s.token}} pattern {{s.regex_name}}
  34. span(v-else) {{s}}
  35. script(src='/js/vue.min.js')
  36. script(src='/js/zxcvbn.js')
  37. script(src='/js/moment.js')
  38. script.
  39. moment.locale('it');
  40. var app = new Vue({
  41. el: '#app',
  42. data: {
  43. password: '',
  44. estimationScore: 0,
  45. score: ['inutile', 'pessima', 'brutta', 'così così', 'buona'],
  46. scoreColor: 'red',
  47. slowCrackTime: '',
  48. fastCrackTime: '',
  49. sequence: [],
  50. },
  51. methods: {
  52. checkStrength (e) {
  53. var estimation = zxcvbn(this.password, ['diocane', 'dioporco', 'porcodio', 'madonnacane'])
  54. this.estimationScore = estimation.score;
  55. this.slowCrackTime = moment.duration(estimation.crack_times_seconds.offline_slow_hashing_1e4_per_second, 'seconds').humanize();
  56. this.fastCrackTime = moment.duration(estimation.crack_times_seconds.offline_fast_hashing_1e10_per_second, 'seconds').humanize();
  57. this.sequence = estimation.sequence;
  58. },
  59. }
  60. })