Exemple #1
0
        public void deobfuscate(Blocks blocks)
        {
            if (!Detected)
            {
                return;
            }
            if (stringStructField == null)
            {
                return;
            }

            foreach (var block in blocks.MethodBlocks.getAllBlocks())
            {
                var instrs = block.Instructions;
                for (int i = 0; i < instrs.Count - 1; i++)
                {
                    var ldstr = instrs[i];
                    if (ldstr.OpCode.Code != Code.Ldstr)
                    {
                        continue;
                    }
                    var ldfld = instrs[i + 1];
                    if (ldfld.OpCode.Code != Code.Ldfld)
                    {
                        continue;
                    }
                    if (!MemberReferenceHelper.compareFieldReferenceAndDeclaringType(stringStructField, ldfld.Operand as FieldReference))
                    {
                        continue;
                    }
                    block.remove(i + 1, 1);
                }
            }
        }
Exemple #2
0
        public void deobfuscate(Blocks blocks)
        {
            foreach (var block in blocks.MethodBlocks.getAllBlocks())
            {
                var instrs = block.Instructions;
                for (int i = 0; i < instrs.Count - 2; i++)
                {
                    var ldsfld = instrs[i];
                    if (ldsfld.OpCode.Code != Code.Ldsfld)
                    {
                        continue;
                    }

                    var ldci4 = instrs[i + 1];
                    if (!ldci4.isLdcI4())
                    {
                        continue;
                    }

                    var stfld = instrs[i + 2];
                    if (stfld.OpCode.Code != Code.Stfld)
                    {
                        continue;
                    }

                    var field = stfld.Operand as FieldReference;
                    if (!MemberReferenceHelper.compareFieldReferenceAndDeclaringType(enumField, field))
                    {
                        continue;
                    }
                    block.remove(i, 3);
                    i--;
                }
            }
        }
Exemple #3
0
 static bool matches(IEnumerable <FieldDefinition> ourFields, FieldReference field)
 {
     foreach (var ourField in ourFields)
     {
         if (MemberReferenceHelper.compareFieldReferenceAndDeclaringType(ourField, field))
         {
             return(true);
         }
     }
     return(false);
 }