commit 8d52870bda38862baca925aeed2384eb7fd17dba
parent 92ae8a867e727fd688c55fa4dd4c02a07a6501b2
Author: Michael Constantine Dimopoulos <mk@mcdim.xyz>
Date: Fri, 24 Jun 2022 00:49:06 +0000
Added years
Diffstat:
3 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/src/passcheck.go b/src/passcheck.go
@@ -8,6 +8,7 @@ var version string = "v0.1"
var RED string = "\x1b[31m"
var YEL string = "\u001b[33m"
+var BLUE string = "\033[0;34m"
var GREEN string = "\033[0;32m"
var RESET string = "\x1b[0m"
@@ -80,4 +81,7 @@ func main() {
fmt.Printf("\nWords:\n")
words_test(pass, words) // 0 = words file, 1 = password dictionary
}
+
+ fmt.Printf("\nRecent years:\n")
+ years_test(pass)
}
diff --git a/src/words.go b/src/words.go
@@ -7,7 +7,13 @@ import (
"os"
)
+func get_per(a int, b int) float64 {
+
+ return float64(a)/float64(b)*100.0
+}
+
func deleet(str1 string) string {
+
str2 := strings.ReplaceAll(str1, "3", "e")
str3 := strings.ReplaceAll(str2, "@", "a")
str4 := strings.ReplaceAll(str3, "1", "i")
@@ -40,15 +46,15 @@ func words_test(pass string, file string) {
for fScanner.Scan() {
line := fScanner.Text()
if (len(line) >= 3 && strings.Contains(pass1, line)) {
- var perc float64 = float64(len(line))/float64(len(pass1))*100.0
+ perc := get_per(len(line), len(pass1))
if (perc == 100.0) {
- fmt.Printf(RED + "[!] Password is dictionary word - %.1f - ", perc)
+ fmt.Printf(RED + "[!] Password is dictionary word - %.1f%% - ", perc)
} else if (perc >= 70.0) {
- fmt.Printf(RED + "[!] Password contains dictionary words - %.1f - ", perc)
+ fmt.Printf(RED + "[!] Password contains dictionary words - %.1f%% - ", perc)
} else if (perc >= 35.0) {
- fmt.Printf(YEL + "[-] Password contains dictionary words - %.1f - ", perc)
+ fmt.Printf(YEL + "[-] Password contains dictionary words - %.1f%% - ", perc)
} else {
- fmt.Printf(BLUE + "[~] Password contains dictionary words - %.1f - ", perc)
+ fmt.Printf(BLUE + "[~] Password contains dictionary words - %.1f%% - ", perc)
}
fmt.Printf(RESET + "%s : %s\n", file, line)
found = true
diff --git a/src/years.go b/src/years.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "fmt"
+ "regexp"
+)
+
+func years_test(pass string) {
+
+ r, _ := regexp.Compile("((19)|(20))[0-9]{2}")
+ match := r.MatchString(pass)
+
+ if (match == true) {
+ for _, i := range r.FindAllString(pass, -1) {
+ perc := get_per(4, len(pass))
+
+ if (perc == 100.0) {
+ fmt.Printf(RED + "[!] Password is a recent year- %.1f%% - ", perc)
+ } else if (perc >= 50.0) {
+ fmt.Printf(RED + "[!] Password contains a recent year - %.1f%% - ", perc)
+ } else if (perc >= 35.0) {
+ fmt.Printf(YEL + "[-] Password contains a recent year - %.1f%% - ", perc)
+ } else {
+ fmt.Printf(BLUE + "[~] Password contains a recent year - %.1f%% - ", perc)
+ }
+ fmt.Printf(RESET + "%s\n", i)
+ }
+ } else {
+ fmt.Printf(GREEN + "[~] Password does not contain a recent year\n" + RESET)
+ }
+}