コード例 #1
0
 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;
     }
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
        public IEnumerable<string> Crack(WordList dictionary)
        {
            if (dictionary == null)
            {
                throw new ArgumentNullException("dictionary");
            }

            var cracker = new PasswordCracker(this);
            return cracker.Crack(dictionary);
        }
コード例 #4
0
        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;
                }
            }
        }
コード例 #5
0
 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));
     }
 }