Maybe because the assembly is obfuscated and designed to crash Cecil?

On Tue, Jan 30, 2018 at 7:48 AM, Aon Zen <agon...@gmail.com> wrote:

>
>
> using Mono.Cecil;
> using Mono.Cecil.Cil;
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using System.Threading.Tasks;
>
> namespace HARObfuscator.Protection
> {
>     class Stringhider
>     {
>         static Random rnd = new Random();
>         public static void Start(AssemblyDefinition AD)
>         {
>  (line 18)           foreach (TypeDefinition type in AD.MainModule.Types)
>             {
>                 foreach (MethodDefinition method in type.Methods)
>                 {
>                     if (method.HasBody)
>                         for (int i = 0; i < method.Body.Instructions.Count;
> i++)
>                         {
>                             if (method.Body.Instructions[i].OpCode ==
> OpCodes.Ldstr)
>                             {
>                                 ILProcessor ilp =
> method.Body.GetILProcessor();
>                                 MethodDefinition mdef = new
> MethodDefinition("hider" + rnd.Next(0,80), MethodAttributes.Public,AD.
> MainModule.Import(typeof(string)));
>                                 mdef.Body.Instructions.Add(
> Instruction.Create(OpCodes.Ldstr, method.Body.Instructions[i].
> Operand.ToString()));
>                                 mdef.Body.Instructions.Add(
> Instruction.Create(OpCodes.Ret));
>                                 type.Methods.Add(mdef);
>                                 ilp.InsertAfter(method.Body.Instructions[i],
> Instruction.Create(OpCodes.Call, mdef));
>                             }
>                         }
>                 }
>             }
>
>         }
>     }
> }
>
> --
> --
> --
> mono-cecil
> ---
> You received this message because you are subscribed to the Google Groups
> "mono-cecil" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mono-cecil+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mono-cecil+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to