commit 37ddbcdc27a6bbe54c2e06a55a51121dcd03a324
parent 90718ad73c22d2b0373e341437b3f64ae9f85598
Author: Michael Constantine Dimopoulos <mk@mcdim.xyz>
Date: Fri, 24 Jun 2022 02:25:00 +0000
Added masks
Diffstat:
3 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/src/masks.go b/src/masks.go
@@ -0,0 +1,67 @@
+package main
+
+import (
+ "fmt"
+ "regexp"
+)
+
+func must_match(regex string, pass string) bool {
+ match, _ := regexp.MatchString(regex, pass)
+ return match
+}
+
+
+func mask_test(pass string) {
+
+ str := " Password matches common mask "
+ var found bool
+
+ if (must_match("^[A-Za-z]{1,}$", pass)) {
+ fmt.Printf(RED + "[!]" + str + "^alpha{1,}$ (only letters)\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[0-9]{1,}$", pass)) {
+ fmt.Printf(RED + "[!]" + str + "^num{1,}$ (only numbers)\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[A-Za-z]{1,}[0-9]{1,}$", pass)) {
+ fmt.Printf(YEL + "[-]" + str + "^alpha{1,}num{1,}$\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[0-9]{1,}[A-Za-z]{1,}$", pass)) {
+ fmt.Printf(YEL + "[-]" + str + "^num{1,}alpha{1,}$\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[0-9]{1,}[^A-Za-z0-9]{1,}$", pass)) {
+ fmt.Printf(YEL + "[-]" + str + "^num{1,}symbol{1,}$\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[A-Za-z]{1,}[0-9]{1,}[^A-Za-z0-9]{1,}$", pass)) {
+ fmt.Printf(YEL + "[-]" + str + "^alpha{1,}num{1,}symbol{1,}$\n" + RESET)
+ found = true
+ }
+
+ if (must_match("[^A-Za-z0-9]{1,}$", pass)) {
+ fmt.Printf(BLUE + "[~]" + str + "any{1,}symbol{1,}$\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[A-Za-z]{1,}123$", pass)) {
+ fmt.Printf(YEL + "[-]" + str + "^alpha{1,}123$\n" + RESET)
+ found = true
+ }
+
+ if (must_match("123$", pass)) {
+ fmt.Printf(BLUE + "[~]" + str + "*123$\n" + RESET)
+ found = true
+ }
+
+ if (!found) {
+ fmt.Printf(GREEN + "[+] Password does not match any common mask\n" + RESET)
+ }
+}
diff --git a/src/passcheck.go b/src/passcheck.go
@@ -88,4 +88,7 @@ func main() {
fmt.Printf("\nRecent years:\n")
years_test(pass)
+
+ fmt.Printf("\nCommon masks:\n")
+ mask_test(pass)
}
diff --git a/src/words.go b/src/words.go
@@ -66,7 +66,7 @@ func words_test(pass string, file string) {
fmt.Printf(" contains multiple distinct dictionary words, or if the\n")
fmt.Printf(" words are a small part of the password\n");
} else {
- fmt.Printf(GREEN + "[+] Password was not found in any files\n"+RESET)
+ fmt.Printf(GREEN + "[+] Password does not contain words from " + RESET +"%s\n", file)
}
f.Close()