charset.go (1760B)
1 package main 2 3 import ( 4 "fmt" 5 "unicode" 6 ) 7 8 func IsSymbol(r rune) bool { 9 10 if (r == '!' || r == '@' || r == '#' || 11 r == '$' || r == '%' || r == '^' || 12 r == '&' || r == '*' || r == '(' || 13 r == ')' || r == '-' || r == '{' || 14 r == '}' || r == '[' || r == ']' || 15 r == ':' || r == ';' || r == '"' || 16 r == '\''|| r == '<' || r == '>' || 17 r == '.' || r == '/' || r == '?' || 18 r == '~' || r == '`' || r == ' ') { 19 return true 20 } 21 22 return false 23 } 24 25 func charset_test(pass string) { 26 27 let := false 28 upp := false 29 low := false 30 num := false 31 sym := false 32 33 for _, r := range pass { 34 35 if (unicode.IsDigit(rune(r))) { 36 num = true 37 } 38 39 if (unicode.IsLetter(rune(r))) { 40 let = true 41 42 if (unicode.IsUpper(r)) { 43 upp = true 44 } else { 45 low = true 46 } 47 } 48 49 if (IsSymbol(rune(r))) { 50 sym = true 51 } 52 } 53 54 if (num == true) { 55 fmt.Printf(GREEN + "[+] Your password includes numbers\n" + RESET); 56 } else { 57 fmt.Printf(RED + "[!] Your password doesn't include numbers\n" + RESET); 58 } 59 60 if (sym == true) { 61 fmt.Printf(GREEN + "[+] Your password includes special symbols\n" + RESET); 62 } else { 63 fmt.Printf(RED + "[!] Your password doesn't include special symbols\n" + RESET); 64 } 65 66 if (let == true) { 67 fmt.Printf(GREEN + "[+] Your password includes letters\n" + RESET); 68 69 if (upp == true) { 70 fmt.Printf(GREEN + " [+] includes upper case letters\n" + RESET); 71 } else { 72 fmt.Printf(RED + " [!] doesn't include upper case letters\n" + RESET); 73 } 74 75 if (low == true) { 76 fmt.Printf(GREEN + " [+] includes lower case letters\n" + RESET); 77 } else { 78 fmt.Printf(RED + " [!] doesn't include lower case letters\n" + RESET); 79 } 80 81 } else { 82 fmt.Printf(RED + "[!] Your password doesn't include letters\n" + RESET); 83 } 84 85 }