private static void CrackSingle(string databasePath, string username, string exportPath) { var dictionary = new WordList(); try { var db = new Database(databasePath); if (string.IsNullOrEmpty(exportPath)) { var user = db.GetUser(username); if (user == null) { Console.WriteLine(string.Format("The username '{0}' was not found.", username)); return; } Program.PrintPasswords(user, dictionary); } else { db.Export(exportPath, dictionary, username); Program.WriteExportSuccessMessage(exportPath); } } catch (Exception e) { Console.WriteLine(); Console.WriteLine(string.Format("Unable to crack passwords. The error message was: '{0}'", e.Message)); Console.WriteLine(); return; } }
private static void CrackAll(string databasePath, string exportPath) { var dictionary = new WordList(); try { var db = new Database(databasePath); if (string.IsNullOrEmpty(exportPath)) { var users = db.GetUsers(); foreach (var user in users) { Program.PrintPasswords(user, dictionary); } } else { db.Export(exportPath, dictionary); Program.WriteExportSuccessMessage(exportPath); } } catch (Exception e) { Console.WriteLine(); Console.WriteLine(string.Format("Unable to crack passwords. The error message was: '{0}'", e.Message)); Console.WriteLine(); return; } }
public IEnumerable<string> Crack(WordList dictionary) { if (dictionary == null) { throw new ArgumentNullException("dictionary"); } var cracker = new PasswordCracker(this); return cracker.Crack(dictionary); }
public IEnumerable<string> Crack(WordList dictionary) { if (dictionary == null) { throw new ArgumentNullException("dictionary"); } byte[] wordBytes; foreach (var word in dictionary.Words) { wordBytes = word.CalculateVssHash(); if (this.PasswordToCrack.VssHash.ByteArrayCompare(wordBytes)) { this.OnPasswordFound(word, wordBytes); yield return word; } } }
private static void PrintPasswords(User user, WordList dictionary) { var passwords = user.Password.Crack(dictionary); foreach (var password in passwords) { Console.WriteLine(string.Format("{0}: {1}", user.Username, password)); } }