Ejemplo n.º 1
0
        /// <summary>
        /// Initialize a new 64 bit hook for JIT on the supplied assembly with the callback CompileMethod.
        /// Will determine the runtime version (and JIT hook to use).
        /// </summary>
        /// <param name="asm">The assembly to wrap.</param>
        /// <param name="hookedCompileMethod64">The CompileMethod to call instead of the original.</param>
        public HookHelper64(Assembly asm, Data.CompileMethodDel64 hookedCompileMethod64)
        {
            LoadedAssembly = asm;
            ModuleScope    = LoadedAssembly.ManifestModule.GetScope();

            // .NET 4.0+
            Hook     = new JITHook64 <ClrjitAddrProvider>(hookedCompileMethod64);
            Original = Hook.OriginalCompileMethod64;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs the JitEncrypt Client Library
        /// </summary>
        /// <param name="remote_url">URL for retrieving remote functions</param>
        public JitEncrypt(string remote_url = "")
        {
            EncryptedMethod.DOWNLOAD_URL = remote_url;

            Methods    = new List <JitMethodBase>();
            _jitHook64 = new JITHook64 <ClrjitAddrProvider>();


            Win32.Print("Mapping methods...");
            DetectMethods();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize a new 64 bit hook for JIT on the supplied assembly with the callback CompileMethod.
        /// Will determine the runtime version (and JIT hook to use).
        /// </summary>
        /// <param name="asm">The assembly to wrap.</param>
        /// <param name="hookedCompileMethod64">The CompileMethod to call instead of the original.</param>
        public HookHelper64(Assembly asm, Data.CompileMethodDel64 hookedCompileMethod64)
        {
            LoadedAssembly = asm;
            ModuleScope    = LoadedAssembly.ManifestModule.GetScope();

            if (LoadedAssembly.ImageRuntimeVersion == "v2.0.50727")
            {
                // .NET 2.0-3.5
                Hook = new JITHook64 <MscorjitAddrProvider>(hookedCompileMethod64);
            }
            else
            {
                // .NET 4.0+
                Hook = new JITHook64 <ClrjitAddrProvider>(hookedCompileMethod64);
            }

            Original = Hook.OriginalCompileMethod64;
        }
Ejemplo n.º 4
0
        private static unsafe void Main()
        {
            _jitHook = new JITHook64 <ClrjitAddrProvider>();
            if (_jitHook.Hook(HookedCompileMethod))
            {
                Console.WriteLine("Successfully installed hook!\r\n");
            }

            Console.WriteLine(Foo());

            Console.WriteLine("\r\n");
            if (_jitHook.UnHook())
            {
                Console.WriteLine("Successfully uninstalled hook!\r\n");
            }

            Console.WriteLine(Bar());

            Console.ReadLine();
        }
Ejemplo n.º 5
0
        private static unsafe void Main()
        {
            _jitHook = new JITHook64<ClrjitAddrProvider>();
            if (_jitHook.Hook(HookedCompileMethod))
                Console.WriteLine("Successfully installed hook!\r\n");

            Console.WriteLine(Foo());

            Console.WriteLine("\r\n");
            if (_jitHook.UnHook())
                Console.WriteLine("Successfully uninstalled hook!\r\n");

            Console.WriteLine(Bar());

            Console.ReadLine();
        }