示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HookServer" /> class.
        /// </summary>
        /// <param name="context">Easyhook remoting context.</param>
        /// <param name="channelName">IPC channel name.</param>
        /// <param name="projectDirectory">The project directory to use when loading content.</param>
        public HookServer(RemoteHooking.IContext context, String channelName)
        {
            // Get reference to IPC to host application
            this.HookClient = RemoteHooking.IpcConnectClient <HookClientBase>(channelName);

            // Call the client immediately to test a successful connection
            this.HookClient.Log("Hook successfully connected");

            // Attempt to create a IpcServerChannel so that any event handlers on the client will function correctly
            try
            {
                System.Collections.IDictionary properties = new System.Collections.Hashtable();
                properties["name"]     = channelName;
                properties["portName"] = channelName + Guid.NewGuid().ToString("N");

                //// BinaryServerFormatterSinkProvider binaryProv = new BinaryServerFormatterSinkProvider();
                ////  binaryProv.TypeFilterLevel = TypeFilterLevel.Full;

                ////  IpcServerChannel clientServerChannel = new IpcServerChannel(properties, binaryProv);
                ////  ChannelServices.RegisterChannel(clientServerChannel, false);
            }
            catch (Exception ex)
            {
                this.HookClient.Log("Failed to set up bidirectional hook", ex.ToString());
            }
        }
示例#2
0
 public GHRXInputModPayload(
     RemoteHooking.IContext aInContext,
     String aInChannelName)
 {
     _interface = RemoteHooking.IpcConnectClient <GHRXInputModInterface.GHRXInputModInterface>(aInChannelName);
     _instance  = this;
 }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HookServer" /> class
        /// </summary>
        /// <param name="context">Easyhook remoting context</param>
        /// <param name="channelName">IPC channel name</param>
        /// <param name="projectDirectory">The Ana project directory to use when loading content</param>
        public HookServer(RemoteHooking.IContext context, String channelName, String projectDirectory)
        {
            this.IpcServerChannel = null;
            this.DirectXHook      = null;

            // Get reference to IPC to host application
            this.HookClient = RemoteHooking.IpcConnectClient <HookClient>(channelName);

            // We try to ping immediately, if it fails then injection fails
            this.HookClient.Ping();

            // Attempt to create a IpcServerChannel so that any event handlers on the client will function correctly
            IDictionary properties = new Hashtable();

            properties["name"]     = channelName;
            properties["portName"] = channelName + Guid.NewGuid().ToString("N");

            BinaryServerFormatterSinkProvider binaryServerFormatterSinkProvider = new BinaryServerFormatterSinkProvider();

            binaryServerFormatterSinkProvider.TypeFilterLevel = TypeFilterLevel.Full;

            IpcServerChannel clientServerChannel = new IpcServerChannel(properties, binaryServerFormatterSinkProvider);

            ChannelServices.RegisterChannel(clientServerChannel, false);
        }
示例#4
0
        public bool Inject()
        {
            var guilty_gear = Process.GetProcessesByName("GuiltyGearXrd");

            if (guilty_gear.Length > 0)
            {
                var PID     = guilty_gear[0].Id;
                var library = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Rev2Hook.dll");

                RemoteHooking.IpcCreateServer <XrdServer>(ref channelName, System.Runtime.Remoting.WellKnownObjectMode.Singleton);

                try
                {
                    RemoteHooking.Inject(PID, library, library, channelName);
                    server = RemoteHooking.IpcConnectClient <XrdServer>(channelName);
                    server.SetModsPath(
                        Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                        + "\\rev2_mods");
                    return(true);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error while injecting: {0}", e);
                    return(false);
                }
            }
            ;
            return(false);
        }
示例#5
0
        public EntryPoint(RemoteHooking.IContext context, string channelName, string dataJsonPath)
        {
            _bridge = RemoteHooking.IpcConnectClient <Bridge>(channelName);
            _bridge.Ping();

            Hook.Initialize(_bridge, dataJsonPath);
        }
示例#6
0
        public HookInjection(
            RemoteHooking.IContext InContext,
            String InChannelName,
            String entryPoint,
            String dll,
            String returnType,
            String scriptBlock,
            String modulePath,
            String additionalCode,
            bool eventLog)
        {
            Log("Opening hook interface channel...", eventLog);
            Interface = RemoteHooking.IpcConnectClient <HookInterface>(InChannelName);
            try
            {
                Runspace = RunspaceFactory.CreateRunspace();
                Runspace.Open();

                //Runspace.SessionStateProxy.SetVariable("HookInterface", Interface);
            }
            catch (Exception ex)
            {
                Log("Failed to open PowerShell runspace." + ex.Message, eventLog);
                Interface.ReportError(RemoteHooking.GetCurrentProcessId(), ex);
            }
        }
示例#7
0
        public EntryPoint(
            RemoteHooking.IContext context,
            string channelName,
            OverlayConfig config)
        {
            // Get reference to IPC to host application
            // Note: any methods called or events triggered against _interface will execute in the host process.
            _interface = RemoteHooking.IpcConnectClient <OverlayInterface>(channelName);

            // We try to ping immediately, if it fails then injection fails
            _interface.Ping();

            #region Allow client event handlers (bi-directional IPC)

            // Attempt to create a IpcServerChannel so that any event handlers on the client will function correctly
            IDictionary properties = new Hashtable();
            properties["name"]     = channelName;
            properties["portName"] = channelName + Guid.NewGuid().ToString("N"); // random portName so no conflict with existing channels of channelName

            var binaryProv = new BinaryServerFormatterSinkProvider();
            binaryProv.TypeFilterLevel = TypeFilterLevel.Full;

            var clientServerChannel = new IpcServerChannel(properties, binaryProv);
            ChannelServices.RegisterChannel(clientServerChannel, false);

            #endregion
        }
        public void Connect()
        {
            _ChannelName = null;
            log.Info("Dll to inject: " + _InjectDll);
            try
            {
                log.Info("  Creating IPC server");
                IpcServer = RemoteHooking.IpcCreateServer <PSInterface>(
                    ref _ChannelName, System.Runtime.Remoting.WellKnownObjectMode.Singleton);

                log.Info("  Connect to IPC as client to get interface");
                Iface = RemoteHooking.IpcConnectClient <PSInterface>(_ChannelName);
                ;
                log.Info("  Set interface properties");
                Iface.RunButton = Valve.VR.EVRButtonId.k_EButton_Axis0;
                log.Info("    Interface RunButton: " + Iface.RunButton);
                Iface.ButtonType = PStrafeButtonType.Press;
                log.Info("    Interface ButtonType: " + Iface.ButtonType);
                Iface.Hand = PStrafeHand.Left;
                log.Info("    Interface Hand: " + Iface.Hand);

                log.Info("  Subscribe to interface events:");
                log.Info("    UserIsRunning event");
                this.WhenAnyValue(x => x.UserIsRunning)
                .Do(x => Iface.UserIsRunning = x)
                .Subscribe();
            }
            catch (Exception ex)
            {
                log.Error("  EasyHook Error: " + ex.Message);
                log.Error(ex);
                throw new PocketStrafeOutputDeviceException(ex.Message);
            }
        }
示例#9
0
        public Main(RemoteHooking.IContext context, string channelName, VisualRenderType visualRenderType)
        {
            _visualRenderType = visualRenderType;
            // Connect to server object using provided channel name
            var @interface = RemoteHooking.IpcConnectClient <InjectorInterface>(channelName);

            Process = Process.GetProcessById(RemoteHooking.GetCurrentProcessId());
            foreach (ProcessModule processModule in Process.Modules)
            {
                try
                {
                    ModuleInfos.Add(processModule.ModuleName,
                                    new ModuleInfo
                    {
                        Name       = processModule.ModuleName,
                        MemorySize = processModule.ModuleMemorySize,
                        Address    = processModule.BaseAddress
                    });
                }
                catch
                {
                    // ignored
                }
            }

            // If Ping fails then the Run method will be not be called
            @interface.Ping();
        }
示例#10
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
            Process process = null;

            while (process == null)
            {
                process = Process.GetProcessesByName("Warframe.x64").FirstOrDefault();
            }

            string channelName = null;
            string libraryPath = "WfDx.dll";

            RemoteHooking.IpcCreateServer <ServerInterface>(ref channelName, WellKnownObjectMode.Singleton);
            client = RemoteHooking.IpcConnectClient <ServerInterface>(channelName);
            try
            {
                RemoteHooking.Inject(process.Id, libraryPath, libraryPath, channelName);
                Console.ReadLine();
                client.RunLibrary = false;
            }
            catch (Exception e)
            {
                Console.WriteLine($"Something goes wrong {e}");
            }
        }
示例#11
0
 public ButtplugGameVibrationRouterPayload(
     RemoteHooking.IContext aInContext,
     String aInChannelName)
 {
     _interface = RemoteHooking.IpcConnectClient <ButtplugGameVibrationRouterInterface>(aInChannelName);
     _instance  = this;
 }
示例#12
0
 public XboxOneControllerInjection(
     RemoteHooking.IContext InContext,
     String InChannelName)
 {
     Interface = RemoteHooking.IpcConnectClient <RemoInterface>(InChannelName);
     Hooks     = new List <LocalHook>();
     Interface.Ping(RemoteHooking.GetCurrentProcessId());
 }
示例#13
0
        public Main(
            RemoteHooking.IContext InContext,
            String InChannelName)
        {
            Interface = RemoteHooking.IpcConnectClient <HookInterface>(InChannelName);

            Interface.Ping();
        }
示例#14
0
 public WindowHookInterceptor(
     RemoteHooking.IContext InContext,
     string InChannelName)
 {
     _interface = RemoteHooking.IpcConnectClient <HookHostCommunicator>(
         InChannelName);
     _interface.Ping();
 }
示例#15
0
文件: EntryPoint.cs 项目: Shynd/OHook
        public EntryPoint(RemoteHooking.IContext context, string channelName)
        {
            // Connect to the server object using provided channel name
            Interface = RemoteHooking.IpcConnectClient <ServerInterface>(channelName);


            Interface.Ping();
        }
示例#16
0
 public Main(
     RemoteHooking.IContext InContext,
     String InChannelName)
 {
     // connect to host...
     Interface = RemoteHooking.IpcConnectClient <CaxaHook.HookDealWith>(InChannelName);
     //  Interface.Ping();
 }
示例#17
0
 public TestClass(
     RemoteHooking.IContext InContext,
     String InChannelName)
 {
     // connect to host...
     Interface = RemoteHooking.IpcConnectClient <FileMonInterface>(InChannelName);
     Interface.Ping();
 }
        public InjectionEntryPoint(EasyHook.RemoteHooking.IContext context, string channelName)
        {
            // Connect to server object using provided channel name
            _server = RemoteHooking.IpcConnectClient <ServerInterface>(channelName);

            // If Ping fails then the Run method will be not be called
            _server.Ping();
        }
 public Main(RemoteHooking.IContext InContext, String InChannelName)
 {
     Console.WriteLine("test");
     luaInterface = RemoteHooking.IpcConnectClient <LuaInterface>(InChannelName);
     ChannelName  = InChannelName;
     luaInterface.WriteLine("get current process id: " + RemoteHooking.GetCurrentProcessId());
     luaInterface.WriteLine("end main()");
 }
示例#20
0
 /// <summary>
 /// This constructor is the first method that will be called in this entire injected DLL.
 /// </summary>
 public EntryPoint(RemoteHooking.IContext context, string channelName)
 {
     // Connect our IPC channel
     this.IpcInterface = RemoteHooking.IpcConnectClient <IpcInterface>(channelName);
     // We can now communicate freely with FileMonitorController
     // But let's ping FileMonitorController just to make sure
     this.IpcInterface.Ping();
 }
示例#21
0
        public Injection(RemoteHooking.IContext InContext, string ipcChannelName)
        {
            Messenger = RemoteHooking.IpcConnectClient <MessengerService>(ipcChannelName);

            Logger = new LoggingService();

            Logger.Log(EventLogEntryType.Information, "[INFECTION] Infection had been initialized");
        }
示例#22
0
        public DemoInjection(
            RemoteHooking.IContext InContext,
            String InChannelName)
        {
            Interface = RemoteHooking.IpcConnectClient <DemoInterface>(InChannelName);

            Interface.Ping(RemoteHooking.GetCurrentProcessId());
        }
示例#23
0
 public Injected(RemoteHooking.IContext iContext,
                 string channel
                 )
 {
     _channel = channel;
     _monitor = RemoteHooking.IpcConnectClient <HookMonitor>(channel);
     Console.WriteLine($"VirtualFileSystem Injected Dll Ver.{Version}");
 }
示例#24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Main"/> class.
        /// </summary>
        /// <param name="inContext">The remote hook context.</param>
        /// <param name="inChannelName">The channel name.</param>
        public Main(RemoteHooking.IContext inContext, string inChannelName)
        {
            _endsceneSkip    = true;
            _frameNumber     = 0;
            _endSceneCounter = 0;

            _interface = RemoteHooking.IpcConnectClient <SF4Interface>(inChannelName);
            _interface.WriteConsole("Dll successfully injected.");
        }
示例#25
0
 public ScreenshotInjection(
     RemoteHooking.IContext context,
     String channelName,
     Direct3DVersion version)
 {
     // Get reference to IPC to host application
     // Note: any methods called or events triggered against _interface will execute in the host process.
     _interface = RemoteHooking.IpcConnectClient <ScreenshotInterface.ScreenshotInterface>(channelName);
 }
示例#26
0
        public Main(
            RemoteHooking.IContext InContext,
            String InChannelName)
        {
            // connect to host...
            Interface = RemoteHooking.IpcConnectClient <eve_probe.HookInterface>(InChannelName);

            Interface.Ping();
        }
示例#27
0
 /// <summary>
 /// Spawned within the client (hooked process)
 /// </summary>
 /// <param name="context"></param>
 /// <param name="channelName"></param>
 public EasyHookEntryPoint(RemoteHooking.IContext context, string channelName, BridgeEventType enabledHooks, int processId)
 {
     // Retrieve a reference to our interface
     this.hookInterface = RemoteHooking.IpcConnectClient <HookInterface>(channelName);
     // Validate connection
     this.hookInterface.Ping();
     this.enabledHooks = enabledHooks;
     this.ProcessID    = processId;
 }
        public InjectionEntryPoint(RemoteHooking.IContext context, string channelName)
        {
            LastImageUpdate = DateTime.Now;

            Server   = RemoteHooking.IpcConnectClient <ImageStreamProxy>(channelName);
            Settings = Server.GetSettings();

            CreateCallbackChannel(channelName);
        }
示例#29
0
        private static void Install()
        {
            lock (ThreadSafe)
            {
                // Ensure we create a new one if the existing
                // channel cannot be pinged
                try
                {
                    if (m_Interface != null)
                    {
                        m_Interface.Ping();
                    }
                }
                catch
                {
                    m_Interface = null;
                }

                if (m_Interface == null)
                {
                    String ChannelName       = RemoteHooking.GenerateName();
                    String SvcExecutablePath = (Config.DependencyPath.Length > 0 ? Config.DependencyPath : Config.GetProcessPath()) + Config.GetWOW64BypassExecutableName();

                    Process          Proc      = new Process();
                    ProcessStartInfo StartInfo = new ProcessStartInfo(
                        SvcExecutablePath, "\"" + ChannelName + "\"");

                    // create sync objects
                    EventWaitHandle Listening = new EventWaitHandle(
                        false,
                        EventResetMode.ManualReset,
                        "Global\\Event_" + ChannelName);

                    m_TermMutex = new Mutex(true, "Global\\Mutex_" + ChannelName);

                    // start and connect program
                    StartInfo.CreateNoWindow = true;
                    StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;

                    Proc.StartInfo = StartInfo;

                    Proc.Start();

                    if (!Listening.WaitOne(5000, true))
                    {
                        throw new ApplicationException("Unable to wait for service application due to timeout.");
                    }

                    HelperServiceInterface Interface = RemoteHooking.IpcConnectClient <HelperServiceInterface>(ChannelName);

                    Interface.Ping();

                    m_Interface = Interface;
                }
            }
        }
 // ReSharper disable once UnusedParameter.Local
 public InjectionEntryPoint(RemoteHooking.IContext context, string channelName)
 {
     Server      = RemoteHooking.IpcConnectClient <ServerInterface>(channelName);
     SearchPaths = new[] {
         Server.PluginConfigDirectory,
         Path.GetDirectoryName(typeof(InjectionEntryPoint).Assembly.Location)
     };
     LoadPlugins();
     InitAllPlugin();
 }