gopasscheck

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

wordlists.go (1361B)


      1 package main
      2 
      3 import (
      4 	"fmt"
      5 	"bufio"
      6 	"os"
      7 	"strings"
      8 )
      9 
     10 
     11 func wordlist_test(pass string, file string) {
     12 
     13 	pass1 := deleet(pass)
     14 
     15 	f, err := os.Open(file)
     16 
     17 	if err != nil {
     18 		fmt.Fprintln(os.Stderr, err)
     19 		os.Exit(1)
     20 	}
     21 
     22 	fScanner := bufio.NewScanner(f)
     23 
     24 	fScanner.Split(bufio.ScanLines)
     25 
     26 	var found bool
     27 	i := 1
     28 	for fScanner.Scan() {
     29 		line := fScanner.Text()
     30 		if (len(line) >= 3 && pass == line) {
     31 
     32 			fmt.Printf(RED + "\n[!!!] Password is in cracking dictionary - ")
     33 
     34 			fmt.Printf(RESET + "%s:%d : %s\n\n", file,i, line)
     35 			found = true
     36 		} else if (len(line) >= 3 && strings.Contains(pass1, line)) {
     37 			perc := get_per(len(line), len(pass1))
     38 			if (perc == 100.0) {
     39 				fmt.Printf(RED + "[!] Deleetified password is in cracking dictionary - %.1f%% - ", perc)
     40 			} else if (perc >= 70.0) {
     41 				fmt.Printf(RED + "[!] Deleetified password contains cracking dictionary password - %.1f%% - ", perc)
     42 			} else if (perc >= 35.0) {
     43 				fmt.Printf(YEL + "[-] Deleetified password contains cracking dictionary password - %.1f%% - ", perc)
     44 			} else {
     45 				fmt.Printf(BLUE + "[~] Deleetified password contains cracking dictionary password - %.1f%% - ", perc)
     46 			}
     47 			fmt.Printf(RESET + "%s : %s\n", file, line)
     48 			found = true
     49 		}
     50 		i++
     51 	}
     52 
     53 	if (!found) {
     54 		fmt.Printf(GREEN + "[+] Password is not in cracking dictionary " + RESET +"%s\n", file)
     55 	}
     56 	
     57 	f.Close()
     58 }