Ejemplo n.º 1
0
        static bool FindKey2OrKey3(IList <Instruction> instrs, ref int index, out uint key)
        {
            key = 0;
            if (index + 6 >= instrs.Count)
            {
                return(false);
            }
            int i = index;

            if (!instrs[i++].IsLdloc())
            {
                return(false);
            }
            if (!instrs[i++].IsLdloc())
            {
                return(false);
            }
            if (!ConfuserUtils.IsCallMethod(instrs[i++], Code.Callvirt, "System.Int32 System.IO.BinaryReader::ReadInt32()"))
            {
                return(false);
            }
            var ldci4 = instrs[i++];

            if (!ldci4.IsLdcI4())
            {
                return(false);
            }
            if (instrs[i++].OpCode.Code != Code.Xor)
            {
                return(false);
            }
            if (!ConfuserUtils.IsCallMethod(instrs[i++], Code.Callvirt, "System.Byte[] System.IO.BinaryReader::ReadBytes(System.Int32)"))
            {
                return(false);
            }
            if (!instrs[i++].IsStloc())
            {
                return(false);
            }

            key   = (uint)ldci4.GetLdcI4Value();
            index = i;
            return(true);
        }
Ejemplo n.º 2
0
        static bool CheckCallvirtReadUInt32(IList <Instruction> instrs, ref int index)
        {
            if (index + 2 >= instrs.Count)
            {
                return(false);
            }

            if (!instrs[index].IsLdloc())
            {
                return(false);
            }
            if (!ConfuserUtils.IsCallMethod(instrs[index + 1], Code.Callvirt, "System.UInt32 System.IO.BinaryReader::ReadUInt32()"))
            {
                return(false);
            }
            if (!instrs[index + 2].IsStloc() && instrs[index + 2].OpCode.Code != Code.Pop)
            {
                return(false);
            }

            index += 3;
            return(true);
        }