-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyboardPatternChecker.java
More file actions
31 lines (27 loc) · 990 Bytes
/
KeyboardPatternChecker.java
File metadata and controls
31 lines (27 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.*;
public class KeyboardPatternChecker implements PasswordPatternChecker {
private final List<String> keyboardPatterns;
public KeyboardPatternChecker(List<String> keyboardPatterns) {
this.keyboardPatterns = keyboardPatterns;
}
@Override
public List<Finding> check(String password) {
List<Finding> findings = new ArrayList<>();
String pwLow = password.toLowerCase();
for (String pattern : keyboardPatterns) {
if (pwLow.contains(pattern)) {
findings.add(new Finding(
Finding.Severity.CRITICAL,
"Sequenza tastiera rilevata",
"Pattern come qwerty, asdf, 1234 sono testati per primi in qualsiasi attacco dizionario."
));
break;
}
}
return findings;
}
@Override
public String getName() {
return "Sequenze tastiera";
}
}