示例#1
0
        public void Run(RemoteHooking.IContext InContext, string serverName)
        {
            try
            {
                myClientInstance.SendCommand(Command.ClientVersion, myDateStamp);
                myCloseSocketHook = LocalHook.Create(LocalHook.GetProcAddress("WSOCK32.dll", "closesocket"), myCloseSocketDelegate, null);
                mySocketHook      = LocalHook.Create(LocalHook.GetProcAddress("WSOCK32.dll", "socket"), mySocketDelegate, null);
                myCloseSocketHook.ThreadACL.SetExclusiveACL(new int[] { 0 });
                mySocketHook.ThreadACL.SetExclusiveACL(new int[] { 0 });
                IntPtr functionPtr = Marshal.GetFunctionPointerForDelegate(myRecvDelegate);
                myClientInstance.SendCommand(Command.FunctionPointer, functionPtr.ToInt32(), 0);
                functionPtr = Marshal.GetFunctionPointerForDelegate(mySendDelegate);
                myClientInstance.SendCommand(Command.FunctionPointer, functionPtr.ToInt32(), 1);
                MessageHook.Initialize(myClientInstance);
            }
            catch (Exception X)
            {
                string message = "<Exception : " + X.Message + "> <Stack trace: " + X.StackTrace + ">";
                myClientInstance.SendCommand(Command.Exception, message);
                return;
            }

            while (true)
            {
                Thread.Sleep(1000);
            }
        }
示例#2
0
        public void Run(RemoteHooking.IContext InContext, string serverName)
        {
            try
            {
                myClientInstance.SendCommand(Command.ClientVersion, myDateStamp);
                IntPtr functionPtr = Marshal.GetFunctionPointerForDelegate(myRecvDelegate);
                myClientInstance.SendCommand(Command.FunctionPointer, functionPtr.ToInt32(), 0);
                functionPtr = Marshal.GetFunctionPointerForDelegate(mySendDelegate);
                myClientInstance.SendCommand(Command.FunctionPointer, functionPtr.ToInt32(), 1);
                MessageHook.Initialize(myClientInstance);
            }
            catch (Exception X)
            {
                string message = "<Exception : " + X.Message + "> <Stack trace: " + X.StackTrace + ">";
                myClientInstance.SendCommand(Command.Exception, message);
                return;
            }

            while (true)
            {
                Thread.Sleep(1000);
            }
        }