commit 13eae5f20aced17cc2044951988b345634ed6825
parent 37ddbcdc27a6bbe54c2e06a55a51121dcd03a324
Author: Michael Constantine Dimopoulos <mk@mcdim.xyz>
Date: Fri, 24 Jun 2022 14:34:26 +0000
Added more masks
Diffstat:
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/src/masks.go b/src/masks.go
@@ -11,7 +11,7 @@ func must_match(regex string, pass string) bool {
}
-func mask_test(pass string) {
+func mask_test(pass string) { // according to pipal
str := " Password matches common mask "
var found bool
@@ -65,3 +65,42 @@ func mask_test(pass string) {
fmt.Printf(GREEN + "[+] Password does not match any common mask\n" + RESET)
}
}
+
+func popular_characters_test(pass string) { //according to lykan
+
+ var found bool
+
+ if (must_match("^[^A-Za-z]*[Aa][^A-Za-z]*$", pass)) {
+ fmt.Printf(YEL + "[-] Passowrd's only letter is the most common letter in passwords\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[^A-Za-z]*[Ee][^A-Za-z]*$", pass)) {
+ fmt.Printf(YEL + "[-] Passowrd's only letter is the second most common letter in passwords\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[^0-9]*1[^0-9]*$", pass)) {
+ fmt.Printf(YEL + "[-] Passowrd's only number is the most common number in passwords\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[^0-9]*0[^0-9]*$", pass)) {
+ fmt.Printf(YEL + "[-] Passowrd's only number is the second most common number in passwords\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[A-Za-z0-9]*\\.[A-Za-z0-9]*$", pass)) {
+ fmt.Printf(YEL + "[-] Passowrd's only symbol is the most common symbol in passwords\n" + RESET)
+ found = true
+ }
+
+ if (must_match("^[A-Za-z0-9]*-[A-Za-z0-9]*$", pass)) {
+ fmt.Printf(YEL + "[-] Passowrd's only symbol is the second most common symbol in passwords\n" + RESET)
+ found = true
+ }
+
+ if (!found) {
+ fmt.Printf(GREEN + "[+] Password does not overuse popular characters\n" + RESET)
+ }
+}
diff --git a/src/passcheck.go b/src/passcheck.go
@@ -91,4 +91,7 @@ func main() {
fmt.Printf("\nCommon masks:\n")
mask_test(pass)
+
+ fmt.Printf("\nPopular characters:\n")
+ popular_characters_test(pass)
}