gopasscheck

[unmaintained] password strength checking utility
git clone git://mcdim.xyz/gopasscheck.git
Log | Files | Refs | README

years.go (794B)


      1 package main
      2 
      3 import (
      4 	"fmt"
      5 	"regexp"
      6 )
      7 
      8 func years_test(pass string) {
      9 
     10 	r, _ := regexp.Compile("((19)|(20))[0-9]{2}")
     11 	match := r.MatchString(pass)
     12 
     13 	if (match == true) {
     14 		for _, i := range r.FindAllString(pass, -1) {
     15 			perc := get_per(4, len(pass))
     16 
     17 			if (perc == 100.0) {
     18 				fmt.Printf(RED + "[!] Password is a recent year- %.1f%% - ", perc)
     19 			} else if (perc >= 50.0) {
     20 				fmt.Printf(RED + "[!] Password contains a recent year - %.1f%% - ", perc)
     21 			} else if (perc >= 35.0) {
     22 				fmt.Printf(YEL + "[-] Password contains a recent year - %.1f%% - ", perc)
     23 			} else {
     24 				fmt.Printf(BLUE + "[~] Password contains a recent year - %.1f%% - ", perc)
     25 			}
     26 			fmt.Printf(RESET + "%s\n", i)
     27 		}
     28 	} else {
     29 		fmt.Printf(GREEN + "[+] Password does not contain a recent year\n" + RESET)
     30 	}
     31 }