Exemple #1
0
        public PatternFinder(RemoteProcess process, string moduleName)
        {
            m_Process = process;
            var module = process[moduleName];

            m_Module = module ?? throw new ArgumentException($"Module '{moduleName}' not found.", nameof(moduleName));
        }
        /// <summary>
        /// Constructor of the Class
        /// </summary>
        public PluginServices()
        {
            // initialize remote plug-in configuration
            remote = new RemoteModule("plugin");

            // check for updates
            CheckUpdates();

            // find available plug-in
            FindPlugins();
        }
Exemple #3
0
        public Player(MemorySharp process)
        {
            _process = process;

            foreach (var module in _process.Modules.RemoteModules.Where(module => string.Equals(module.Name, "client.dll")))
            {
                _clientModule = module;
            }

            _entity = new Entity(_process);
        }
Exemple #4
0
 public bool IsGameReady()
 {
     try
     {
         clientDll = mem.Modules["client.dll"];
         engineDll = mem.Modules["engine.dll"];
         return(true);
     } catch
     {
         return(false);
     }
 }
Exemple #5
0
        public InjectedModule Inject(string dllPath)
        {
            Open();

            RemoteModule kernel32      = GetRemoteKernel32();
            string       fullPath      = Path.GetFullPath(dllPath);
            IntPtr       loadedLibrary = kernel32.ExecuteFunction("LoadLibraryA", Encoding.ASCII.GetBytes(fullPath)).Address;

            if (loadedLibrary == IntPtr.Zero)
            {
                int error = Marshal.GetLastWin32Error();
                ;
                throw new ModuleException($"Failed to inject {dllPath} library.");
            }

            IntPtr localHandle = Kernel32.LoadLibraryA(fullPath);

            if (localHandle == IntPtr.Zero)
            {
                throw new ModuleException($"Failed to load {fullPath} to local process.");
            }

            return(new InjectedModule(loadedLibrary, localHandle, this, dllPath));
        }
Exemple #6
0
        private async Task ReceiveRemoteModuleDataAsync()
        {
            try
            {
                HMessage packet = await RemoteModule.ReceivePacketAsync().ConfigureAwait(false);

                if (packet == null)
                {
                    DataAwaiters.Values.ToList().ForEach(awaiter =>
                    {
                        if (awaiter != null)
                        {
                            awaiter.SetResult(null);
                        }
                    });

                    RemoteModule = null;
                    Task grabRemoteModuleTask =
                        GrabRemoteModuleAsync();

                    return;
                }

                var response = new HMessage(packet.Header);
                #region Switch: packet.Header
                switch (packet.Header)
                {
                default: response = null; break;

                case 0:
                {
                    response.WriteShort((ushort)Hotel);
                    break;
                }

                case 1:
                {
                    response.WriteString(Game?.Location);
                    if (!string.IsNullOrWhiteSpace(Game?.Location))
                    {
                        response.WriteString(Path.GetFullPath("Hashes.ini"));
                    }
                    break;
                }

                case 2:
                {
                    response.WriteString(GameData.Source);
                    break;
                }

                case 3:
                {
                    response.WriteShort(Connection.Port);
                    response.WriteString(Connection.Host);
                    response.WriteString(Connection.Address);
                    break;
                }

                case 4:
                {
                    if (Connection != null)
                    {
                        int    dataLength = packet.ReadInteger();
                        byte[] data       = packet.ReadBytes(dataLength);

                        await Connection.SendToClientAsync(
                            data).ConfigureAwait(false);

                        response = null;
                    }
                    break;
                }

                case 5:
                {
                    if (Connection != null)
                    {
                        int    dataLength = packet.ReadInteger();
                        byte[] data       = packet.ReadBytes(dataLength);

                        await Connection.SendToServerAsync(
                            data).ConfigureAwait(false);

                        response = null;
                    }
                    break;
                }

                case 6:
                case 7:
                {
                    string stamp = packet.ReadString();
                    if (DataAwaiters.ContainsKey(stamp))
                    {
                        var destination = (HDestination)(packet.Header - 6);

                        int    step        = packet.ReadInteger();
                        bool   isBlocked   = packet.ReadBoolean();
                        int    dataLength  = packet.ReadInteger();
                        byte[] data        = packet.ReadBytes(dataLength);
                        var    interPacket = new HMessage(data, destination);

                        var args = new DataInterceptedEventArgs(interPacket, step, (destination == HDestination.Server));
                        args.IsBlocked = isBlocked;

                        DataAwaiters[stamp].SetResult(args);
                        response = null;
                    }
                    break;
                }
                }
                #endregion

                if (response != null)
                {
                    await RemoteModule.SendPacketAsync(response).ConfigureAwait(false);
                }
            }
            finally
            {
                if (RemoteModule != null)
                {
                    Task receiveRemModuDataTask =
                        ReceiveRemoteModuleDataAsync();
                }
            }
        }
Exemple #7
0
 /// <summary>
 ///     Finds the pattern scan result from this instances data.
 /// </summary>
 /// <param name="memorySharp">The <see cref="MemorySharp" /> reference.</param>
 /// <param name="remoteModule">The <see cref="RemoteModule" /> the pattern is found in.</param>
 /// <returns></returns>
 public PatternScanResult Find(MemorySharp memorySharp, RemoteModule remoteModule)
 => remoteModule.FindPattern(this);
Exemple #8
0
 public PatternFinder(RemoteProcess process)
 {
     m_Process = process;
     m_Module  = process.MainModule;
 }