private bool InstallHookInternal(int processId)
        {
            try
            {
                var parameter = new HookParameter
                {
                    Msg           = "已经成功注入目标进程",
                    HostProcessId = RemoteHooking.GetCurrentProcessId()
                };

                serverInterface = new HookServer();
                string channelName = null;
                RemoteHooking.IpcCreateServer <HookServer>(ref channelName, System.Runtime.Remoting.WellKnownObjectMode.Singleton, serverInterface);

                RemoteHooking.Inject(
                    processId,
                    InjectionOptions.Default,
                    typeof(HookParameter).Assembly.Location,
                    typeof(HookParameter).Assembly.Location,
                    channelName,
                    parameter
                    );
            }
            catch (Exception ex)
            {
                Debug.Print(ex.ToString());
                return(false);
            }
            injectButton.Enabled = false;
            deattachBtn.Enabled  = true;
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkHook" /> class.
        /// </summary>
        public NetworkHook(HookClientBase hookClient)
        {
            // Do not disable networking for now
            return;

            this.HookClient = hookClient;

            try
            {
                this.RecvHook     = HookServer.CreateHook("ws2_32.dll", "recv", new RecvDelegate(this.RecvEx), this);
                this.SendHook     = HookServer.CreateHook("ws2_32.dll", "send", new SendDelegate(this.SendEx), this);
                this.RecvFromHook = HookServer.CreateHook("ws2_32.dll", "recvfrom", new RecvFromDelegate(this.RecvFromEx), this);
                this.SendToHook   = HookServer.CreateHook("ws2_32.dll", "sendto", new SendToDelegate(this.SendToEx), this);
                this.WSARecvHook  = HookServer.CreateHook("ws2_32.dll", "WSARecv", new WSARecvDelegate(this.WsaRecvEx), this);
                this.WSASendHook  = HookServer.CreateHook("ws2_32.dll", "WSASend", new WSASendDelegate(this.WsaSendEx), this);

                RemoteHooking.WakeUpProcess();

                this.HookClient.Log("Networking Disabled in Process");
            }
            catch (Exception ex)
            {
                this.HookClient.Log("Error activating network hooks", ex.ToString());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RandomHook" /> class.
        /// </summary>
        public RandomHook(HookClientBase hookClient)
        {
            this.HookClient = hookClient;

            return;

            this.HookClient.Log("Unrandomizer loaded");

            this.MsvcrtRandomHook    = HookServer.CreateHook("msvcrt", "rand", new MsvcrtRandomDelegate(this.MsvcrtRandomEx), this);
            this.CryptGenRandomHook  = HookServer.CreateHook("Advapi32.dll", "CryptGenRandom", new CryptGenRandomDelegate(this.CryptGenRandomEx), this);
            this.BcryptGenRandomHook = HookServer.CreateHook("Bcrypt", "BCryptGenRandom", new BcryptGenRandomDelegate(this.BCryptGenRandomEx), this);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SpeedHook" /> class.
        /// </summary>
        public SpeedHook(HookClientBase hookClient)
        {
            this.HookClient = hookClient;

            return;

            this.HookClient.Log("Speedhack loaded");

            this.SpeedUp = 3.0;

            try
            {
                this.QueryPerformanceCounterHook = HookServer.CreateHook("Kernel32.dll", "QueryPerformanceCounter", new QueryPerformanceCounterDelegate(this.QueryPerformanceCounterEx), this);
                this.GetTickCountHook            = HookServer.CreateHook("Kernel32.dll", "GetTickCount", new GetTickCountDelegate(this.GetTickCountEx), this);
                this.GetTickCount64Hook          = HookServer.CreateHook("Kernel32.dll", "GetTickCount64", new GetTickCount64Delegate(this.GetTickCount64Ex), this);
            }
            catch (Exception ex)
            {
                this.HookClient.Log("Error activating speed hooks", ex.ToString());
            }
        }