Exemple #1
0
        public void ProcessEntry(DecryptionContext entry)
        {
            var pEntry = entry as PhoenixEntry;
            var ilProc = pEntry.Source.Body.GetILProcessor();

            ilProc.InsertBefore(pEntry.BadInstruction, ilProc.Create(OpCodes.Ldstr, pEntry.PlainText));
        }
Exemple #2
0
        private static void VerifyDecryptionSucceeded(
            JObject decryptedDoc,
            TestDoc expectedDoc,
            DecryptionContext decryptionContext)
        {
            Assert.AreEqual(expectedDoc.SensitiveStr, decryptedDoc.Property(nameof(TestDoc.SensitiveStr)).Value.Value <string>());
            Assert.AreEqual(expectedDoc.SensitiveInt, decryptedDoc.Property(nameof(TestDoc.SensitiveInt)).Value.Value <int>());
            Assert.IsNull(decryptedDoc.Property(Constants.EncryptedInfo));

            Assert.IsNotNull(decryptionContext);
            Assert.IsNotNull(decryptionContext.DecryptionInfoList);
            DecryptionInfo decryptionInfo = decryptionContext.DecryptionInfoList.First();

            Assert.AreEqual(MdeEncryptionProcessorTests.dekId, decryptionInfo.DataEncryptionKeyId);
            if (expectedDoc.SensitiveStr == null)
            {
                Assert.AreEqual(TestDoc.PathsToEncrypt.Count - 1, decryptionInfo.PathsDecrypted.Count);
                Assert.IsTrue(TestDoc.PathsToEncrypt.Exists(path => !decryptionInfo.PathsDecrypted.Contains(path)));
            }
            else
            {
                Assert.AreEqual(TestDoc.PathsToEncrypt.Count, decryptionInfo.PathsDecrypted.Count);
                Assert.IsFalse(TestDoc.PathsToEncrypt.Exists(path => !decryptionInfo.PathsDecrypted.Contains(path)));
            }
        }
Exemple #3
0
        public void ProcessEntry(DecryptionContext entry)
        {
            var _entry = entry as HurpFuscatorEntry;

            var ilProc = _entry.Source.Body.GetILProcessor();

            ilProc.Replace(_entry.BadInstructions[0], ilProc.Create(OpCodes.Ldstr, _entry.PlainText));
            MarkMember(_entry.BadInstructions[1], _entry.Source);
            MarkMember(_entry.BadInstructions[2], _entry.Source);
        }
Exemple #4
0
        public void DecryptEntry(ref DecryptionContext entry)
        {
            var inputBuffer = Convert.FromBase64String((entry as HurpFuscatorEntry).Arg);
            var bytes       = Encoding.UTF8.GetBytes(Modifier1);
            var rgbIV       = Encoding.UTF8.GetBytes(Modifier2);

            var managed2 = new RijndaelManaged
            {
                BlockSize = 256,
                Padding   = PaddingMode.PKCS7
            };

            (entry as HurpFuscatorEntry).PlainText =
                Encoding.Default.GetString(managed2.CreateDecryptor(bytes, rgbIV).TransformFinalBlock(inputBuffer, 0,
                                                                                                      inputBuffer.Length));
        }
Exemple #5
0
        public void DecryptEntry(ref DecryptionContext entry)
        {
            var destinationArray = new byte[8];
            var provider2        = new MD5CryptoServiceProvider();

            Array.Copy(provider2.ComputeHash(Encoding.ASCII.GetBytes((entry as HurpFuscatorEntry).Arg2)), 0,
                       destinationArray, 0, 8);


            var provider = new DESCryptoServiceProvider
            {
                Key  = destinationArray,
                Mode = CipherMode.ECB
            };

            var inputBuffer = Convert.FromBase64String((entry as HurpFuscatorEntry).Arg1);

            (entry as HurpFuscatorEntry).PlainText =
                Encoding.ASCII.GetString(provider.CreateDecryptor().TransformFinalBlock(inputBuffer, 0, inputBuffer.Length));
        }
Exemple #6
0
        public void DecryptEntry(ref DecryptionContext entry)
        {
            var rEntry = entry as RummageContext;

            if (rEntry.Key == 0)
            {
                ThrowPhaseError("Failed to decrypt string!", 0, false);
            }

            var str = "";

            using (var fs = new FileStream(Globals.DeobContext.InPath, FileMode.Open, FileAccess.Read))
            {
                using (var br = new BinaryReader(fs))
                {
                    if (rEntry.Key == 61 + 1)
                    {
                        rEntry.Key = 62;
                    }

                    uint[] numArray  = null;
                    uint[] numArray2 = null;

                    fs.Seek((rEntry.Key * 4) - _offset, SeekOrigin.End);

                    byte[] outData = null;
                    var    x       = 0;

                    while (x < (numArray ?? new uint[1337]).Length)
                    {
                        uint num = 0;

                        try
                        {
                            num = br.ReadUInt32();
                        }
                        catch (EndOfStreamException e)
                        {
                            break;
                        }
                        catch
                        {
                            PhaseError = new PhaseError
                            {
                                Level   = PhaseError.ErrorLevel.Minor,
                                Message = "Message author!"
                            };
                            continue;
                        }

                        var num2 = br.ReadUInt32();
                        var num3 = 3337565984;

                        var tmp = numArray2;

                        for (var i = 32; i > 0; i--)
                        {
                            num2 -= (((num << 4) ^ (num >> 5)) + num) ^
                                    (num3 + _decMod[(int)((IntPtr)((num3 >> 11) & 3))]);
                            num3 -= 2654435769;
                            num  -= (((num2 << 4) ^ (num2 >> 5)) + num2) ^ (num3 + _decMod[(int)((IntPtr)(num3 & 3))]);
                        }

                        uint[] numArray4;
                        if (tmp == null)
                        {
                            outData   = new byte[num];
                            numArray4 = numArray = new uint[num + 11 / 8 * 2 - 1];
                        }
                        else
                        {
                            numArray[x - 1] = num;
                            numArray4       = numArray;
                        }

                        numArray4[x] = num2;
                        x           += 2;

                        if (x < numArray.Length)
                        {
                            numArray2 = numArray4;
                        }

                        Buffer.BlockCopy(numArray4, 0, outData, 0, outData.Length);
                        str = Encoding.UTF8.GetString(outData);
                    }
                }
            }

            rEntry.PlainText = str;
        }
Exemple #7
0
        public void DecryptEntry(ref DecryptionContext entry)
        {
            var pEntry = entry as PhoenixEntry;

            pEntry.PlainText = DecryptString(pEntry.OldString);
        }