@Override public List<Match> execute(String password) { String reversedPassword = new StringBuilder(password).reverse().toString(); List<Match> matches = new ArrayList<>(); for (Match match: new DictionaryMatcher(this.rankedDictionaries).execute(reversedPassword)) { matches.add(MatchFactory.createReversedDictionaryMatch( password.length() - 1 - match.j, password.length() - 1 - match.i, new StringBuilder(match.token).reverse().toString(), match.matchedWord, match.rank, match.dictionaryName)); } return this.sorted(matches); } }
@Override public List<Match> execute(String password) { String reversedPassword = new StringBuilder(password).reverse().toString(); List<Match> matches = new ArrayList<>(); for (Match match: new DictionaryMatcher(this.rankedDictionaries).execute(reversedPassword)) { matches.add(MatchFactory.createReversedDictionaryMatch( password.length() - 1 - match.j, password.length() - 1 - match.i, new StringBuilder(match.token).reverse().toString(), match.matchedWord, match.rank, match.dictionaryName)); } return this.sorted(matches); } }
@Override public List<Match> execute(String password) { List<Match> matches = new ArrayList<>(); List<Matcher> matchers = new ArrayList<>(); matchers.add(new DictionaryMatcher(dictionaries)); matchers.add(new ReverseDictionaryMatcher(dictionaries)); matchers.add(new L33tMatcher(dictionaries)); matchers.add(new SpatialMatcher()); matchers.add(new RepeatMatcher()); matchers.add(new SequenceMatcher()); matchers.add(new RegexMatcher()); matchers.add(new DateMatcher()); for (Matcher matcher: matchers) matches.addAll(matcher.execute(password)); return this.sorted(matches); } }
@Override public List<Match> execute(String password) { List<Match> matches = new ArrayList<>(); List<Matcher> matchers = new ArrayList<>(); matchers.add(new DictionaryMatcher(dictionaries)); matchers.add(new ReverseDictionaryMatcher(dictionaries)); matchers.add(new L33tMatcher(dictionaries)); matchers.add(new SpatialMatcher()); matchers.add(new RepeatMatcher()); matchers.add(new SequenceMatcher()); matchers.add(new RegexMatcher()); matchers.add(new DateMatcher()); for (Matcher matcher: matchers) matches.addAll(matcher.execute(password)); return this.sorted(matches); } }
if (sub.isEmpty()) break; String subbedPassword = translate(password, sub); for (Match match: new DictionaryMatcher(rankedDictionaries).execute(subbedPassword)) { String token = password.substring(match.i, match.j + 1); if (token.toLowerCase().equals(match.matchedWord)) continue;
if (sub.isEmpty()) break; String subbedPassword = translate(password, sub); for (Match match: new DictionaryMatcher(rankedDictionaries).execute(subbedPassword)) { String token = password.substring(match.i, match.j + 1); if (token.toLowerCase().equals(match.matchedWord)) continue;
@Test public void testDictionaryMatching() throws Exception { List<Match> actualMatches = new DictionaryMatcher(dictionaries).execute(password); assertMatches(message, Pattern.Dictionary, expectedMatches, actualMatches); }