Exemple #1
0
        byte[] DecryptConstant_v15_r60785_dynamic(DecrypterInfo info, byte[] encrypted, uint offs)
        {
            var instrs     = info.decryptMethod.Body.Instructions;
            int startIndex = GetDynamicStartIndex_v15_r60785(instrs);
            int endIndex   = GetDynamicEndIndex_v15_r60785(instrs, startIndex);

            if (endIndex < 0)
            {
                throw new ApplicationException("Could not find start/endIndex");
            }

            var dataReader  = ByteArrayDataReaderFactory.CreateReader(encrypted);
            var decrypted   = new byte[dataReader.ReadInt32()];
            var constReader = new Arg64ConstantsReader(instrs, false);

            ConfuserUtils.DecryptCompressedInt32Data(constReader, startIndex, endIndex, ref dataReader, decrypted);
            return(decrypted);
        }
Exemple #2
0
            public override string Decrypt(MethodDef caller, int magic)
            {
                var reader = stringDecrypter.reader;

                reader.Position = (caller.MDToken.ToInt32() ^ magic) - stringDecrypter.magic1;
                int len       = reader.ReadInt32() ^ (int)~stringDecrypter.magic2;
                var decrypted = new byte[len];

                int startIndex, endIndex;

                if (!FindPolyStartEndIndexes(out startIndex, out endIndex))
                {
                    throw new ApplicationException("Could not get start/end indexes");
                }

                var constReader = new Arg64ConstantsReader(stringDecrypter.decryptMethod.Body.Instructions, false);

                ConfuserUtils.DecryptCompressedInt32Data(constReader, startIndex, endIndex, reader, decrypted);
                return(Encoding.Unicode.GetString(decrypted));
            }