gopasscheck

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

passcheck.go (1901B)


      1 package main 
      2 
      3 import "fmt"
      4 import "os"
      5 
      6 
      7 var version string = "v0.1"
      8 
      9 var RED string = "\x1b[31m"
     10 var YEL string = "\u001b[33m"
     11 var BLUE string = "\033[0;34m"
     12 var GREEN string = "\033[0;32m"
     13 var RESET string = "\x1b[0m"
     14 
     15 func banner() {
     16 	fmt.Printf("goPasstest %s\n" +
     17 		   "'(O.O)' <(better safe than sorry)\n" +
     18 		   "by Michael Constantine Dimopoulos\n" +
     19 		   "https://mcdim.xyz  <mk@mcdim.xyz>\n", version)
     20 }	
     21 
     22 func help(bin string) {
     23 	banner()
     24 	fmt.Printf("	-p, password argument\n" +
     25 		   "	-w, words file argument\n" +
     26 		   "	-h, print this panel and exit\n" +
     27 		   "	-v, print version and exit\n" +
     28 		   "usage: %s [password] | -h | -v\n", bin);
     29 	os.Exit(0)
     30 }
     31 
     32 func print_version() {
     33 	fmt.Printf("gopasscheck-%s\n", version);
     34 	os.Exit(0)
     35 }
     36 
     37 func usage(bin string) {
     38 	fmt.Fprintf(os.Stderr, "usage: %s [password] | -h | -v\n", os.Args[0]);
     39 	os.Exit(1)
     40 }
     41 
     42 func main() {
     43 
     44 	bin := os.Args[0]
     45 
     46 	if (len(os.Args) == 1) {
     47 		usage(bin)
     48 	}
     49 
     50 	if (os.Args[1] == "-h") { help(bin); }
     51 	if (os.Args[1] == "-v") { print_version(); }
     52 	
     53 	var words string = ""
     54 	var pass string = ""
     55 	for i := 0; i < len(os.Args); i++ {
     56 		if (os.Args[i] == "-w") {
     57 			if (len(os.Args) >= i+1) {
     58 				words = os.Args[i+1]
     59 			} else {
     60 				usage(bin)
     61 			} }
     62 
     63 		if (os.Args[i] == "-p" && len(os.Args) > i+1) {
     64 			if (len(os.Args) > i) {
     65 				pass = os.Args[i+1]
     66 			} else {
     67 				usage(bin)
     68 			}
     69 		}
     70 	}
     71 
     72 	if (pass == "") {
     73 		usage(bin)
     74 	}
     75 
     76 	banner()
     77 	fmt.Printf("\nWords: %s\n", words);
     78 	fmt.Printf("Password: %s\n\n", pass);
     79 
     80 	length_test(pass);
     81 	fmt.Printf("\nCharacter set:\n")
     82 	charset_test(pass);
     83 
     84 	if (words != "") {
     85 		fmt.Printf("\nWords:\n")
     86 		words_test(pass, words)
     87 	}
     88 
     89 	fmt.Printf("\nCracking wordlists:\n")
     90 	wordlist_test(pass, "commonpass.txt")
     91 
     92 	fmt.Printf("\nRecent years:\n")
     93 	years_test(pass)
     94 
     95 	fmt.Printf("\nCommon masks:\n")
     96 	mask_test(pass)
     97 
     98 	fmt.Printf("\nPopular characters:\n")
     99 	popular_characters_test(pass)
    100 }