kgleba

NTO Windows Forensics Decryptor (C#)

Mar 27th, 2023 (edited)
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Security.Cryptography;
  5. using System.Text;
  6.  
  7. namespace VTropia
  8. {
  9.     internal class Crypt
  10.     {
  11.         public static void Main(string[] args)
  12.         {
  13.             string password = "084b988baa7c8d98cda90c5fe603c560";
  14.             Crypt.EncryptFile("C:\\Users\\Administrator\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data.p4blm", password);
  15.         }
  16.  
  17.         public static void EncryptFile(string file, string password)
  18.         {
  19.             byte[] bytesToBeEncrypted = File.ReadAllBytes(file);
  20.             byte[] array = Encoding.UTF8.GetBytes(password);
  21.             array = SHA256.Create().ComputeHash(array);
  22.             byte[] bytes = Crypt.AES_Encrypt(bytesToBeEncrypted, array);
  23.             try
  24.             {
  25.                 File.WriteAllBytes(file, bytes);
  26.                 string str = ".p4blm";
  27.                 File.Move(file, file + str);
  28.             }
  29.             catch (UnauthorizedAccessException)
  30.             {
  31.             }
  32.         }
  33.  
  34.         public static byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes)
  35.         {
  36.             byte[] result = null;
  37.             byte[] salt = new byte[]
  38.             {
  39.                 1,
  40.                 8,
  41.                 3,
  42.                 6,
  43.                 2,
  44.                 4,
  45.                 9,
  46.                 7
  47.             };
  48.             using (MemoryStream memoryStream = new MemoryStream())
  49.             {
  50.                 using (RijndaelManaged rijndaelManaged = new RijndaelManaged())
  51.                 {
  52.                     rijndaelManaged.KeySize = 256;
  53.                     rijndaelManaged.BlockSize = 128;
  54.                     Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(passwordBytes, salt, 1000);
  55.                     rijndaelManaged.Key = rfc2898DeriveBytes.GetBytes(rijndaelManaged.KeySize / 8);
  56.                     rijndaelManaged.IV = rfc2898DeriveBytes.GetBytes(rijndaelManaged.BlockSize / 8);
  57.                     rijndaelManaged.Mode = CipherMode.CBC;
  58.                     using (CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndaelManaged.CreateDecryptor(), CryptoStreamMode.Write))
  59.                     {
  60.                         cryptoStream.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length);
  61.                         cryptoStream.Close();
  62.                     }
  63.                     result = memoryStream.ToArray();
  64.                 }
  65.             }
  66.             return result;
  67.         }
  68.     }
  69. }
  70.  
Advertisement
Add Comment
Please, Sign In to add comment