コード例 #1
0
        internal void Initialize(int pid)
        {
            SelectPointerAddresses(GameHashes.DetectVersion(Process.GetProcessesByName("re7").FirstOrDefault().MainModule.FileName));
            memoryAccess = new ProcessMemoryHandler(pid);

            if (ProcessRunning)
            {
                connected   = true;
                BaseAddress = NativeWrappers.GetProcessBaseAddress(pid, PInvoke.ListModules.LIST_MODULES_64BIT).ToInt64(); // Bypass .NET's managed solution for getting this and attempt to get this info ourselves via PInvoke since some users are getting 299 PARTIAL COPY when they seemingly shouldn't.

                PointerMrEverythingCount = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + mrEverythingCount), 0x78L, 0x1F0L);
                PointerDA      = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + difficultyAdjustment));
                PointerMapName = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + mapName), 0x700L);
                PointerHP      = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + hitPoints), 0xA0L, 0xD0L, 0x70L);
                //PointerHP = new MultilevelPointer(memoryAccess, BaseAddress + hitPoints, 0xA0L, 0xD0L, 0x70L);
                PointerEnemyEntryCount = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + enemyHitPoints), 0x190L, 0x70L);
                GenerateEnemyEntries();

                PointerBagCount              = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + bagCount));
                PointerInventoryCount        = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + itemCount), 0x60L);
                PointerInventorySlotSelected = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + selectedSlot), 0x240L, 0x58L, 0x228L);
                PointerItemNames             = new MultilevelPointer[32];
                PointerItemInfo              = new MultilevelPointer[32];
            }
        }
コード例 #2
0
        public void Initialize(Process process)
        {
            if ((_process = process) == null)
            {
                return;
            }

            try
            {
                if (!SetPointerAddresses(GameHashes.DetectVersion(_process?.MainModule?.FileName)))
                {
                    return;
                }
            }
            catch { return; }

            int pid = GetProcessId(_process).Value;

            _processMemory = new ProcessMemoryHandler(pid);

            if (ProcessRunning)
            {
                Pointers.BaseAddress = NativeWrappers.GetProcessBaseAddress(_process.Id, PInvoke.ListModules.LIST_MODULES_32BIT);

                Pointers.WindowHandleId     = IntPtr.Add(Pointers.BaseAddress, Pointers._addressWindowHandle);
                Pointers.FrameCount         = IntPtr.Add(Pointers.BaseAddress, Pointers._addressFrameCount);
                Pointers.CurrentCharacterId = IntPtr.Add(Pointers.BaseAddress, Pointers._addressCurrentCharacterId);
                Pointers.CurrentRoomId      = IntPtr.Add(Pointers.BaseAddress, Pointers._addressCurrentRoomId);
                Pointers.ZombieMaxHP        = IntPtr.Add(Pointers.BaseAddress, Pointers._addressZombieMaxHP);

                Pointers.Characters = new IntPtr[Memory.Characters.Length];
                for (int i = 0; i < Pointers.Characters.Length; ++i)
                {
                    Pointers.Characters[i] = IntPtr.Add(Pointers.BaseAddress, Pointers._addressCharacters + (0xAC4 * i));
                }

                Pointers.Inventory = new IntPtr[Memory.Characters.Length, 18];
                for (int i = 0; i < Pointers.Inventory.GetLength(0); ++i)
                {
                    for (int j = 0; j < Pointers.Inventory.GetLength(1); ++j)
                    {
                        Pointers.Inventory[i, j] = IntPtr.Add(Pointers.BaseAddress, Pointers._addressInventory + (0x438 * i) + (0x3c * j));
                    }
                }

                Pointers.Enemy = new IntPtr[Memory.Enemy.Length];
                for (int i = 0; i < Pointers.Enemy.Length; ++i)
                {
                    Pointers.Enemy[i] = IntPtr.Add(Pointers.BaseAddress, Pointers._addressEnemy + (0xAC4 * i));
                }

                Update();
            }
        }
コード例 #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    _process?.Dispose();
                    _process = null;
                    _processMemory?.Dispose();
                    _processMemory = null;
                }

                // TODO: free unmanaged resources (unmanaged objects) and override finalizer
                // TODO: set large fields to null
                disposedValue = true;
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: skipperbent/CS-Go-trainer
        private static void Main(string[] args)
        {
            int defaultHeight = Console.WindowHeight;
            Console.WindowHeight = 35;
            Console.CursorVisible = false;
            Console.Write(" " +
                          "                                                                               \n" +
                          "                                   ╦                                           \n" +
                          "                                  ▐▌$   ╔@╣▓▓▄╖,                               \n" +
                          "                                 ,█▓▓▄▓▓▓▓▒▓███▌▒▒▒$                           \n" +
                          "                                ▄█▓█████▓▒▓█████▒▒▒µ                           \n" +
                          "                               ▄████████▌▒█████▓▓▓▒╣                           \n" +
                          "                               ▀█████▓▓▓▒▒▒▓▓▒▓▓▓▓Ü▒`                          \n" +
                          "                               ▐███▓▓▓▌▒▒▒╫▄▓▓▓▓██Ü ░                          \n" +
                          "                               ▐▓█▓█▓▓▓╣▒▒╢▒▓▓▓▒█▀                             \n" +
                          "                               ▓████▓█▓▒▄╬╢╣▓▓█╣▓C                             \n" +
                          "                               █████▓█▓╫█▌╫▓▓█▓▓▓                              \n" +
                          "                               ███████▓▓▓▓▓███▓▓▌                              \n" +
                          "                ╓╗╖            █████████▓█▓╬▓▓▓▓▓                              \n" +
                          "               ▐▓▓▓▓       ,╓▄▓▓████████▓▒▒▓▓▓▓▓▓L                             \n" +
                          "                ▓▓▓▓µ ,╖@╫▓▓▓▓██████▓▓▓▓╢╢▓▓▓▓▓▓▓▓@,                           \n" +
                          "                ▓▓▓▓▓@╣╢▒▒▒▓▓▓█████████▓▓█▓█▓▓▓▓▓▓▓▓▓▄,                        \n" +
                          "               ▄▓▓▓▓▓╣╢▓▓▓▓▓███▓███████████▓▓▓▓▓▓▓▓▓▓▓▓▓▄                      \n" +
                          "              ████▓▓▓▓▓▒▒▒▒▒██████▓██████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄                    \n" +
                          "             ]██████▓▓▓▓▓▓▓▓▓██████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓g                  \n" +
                          "             ╫██████▓▓▓▓▓╢╢╣▓█████▓▓▓▓▓▓▓▓▓▓▓▓▓╣▓▓▓▓▓█▓▓▓▓▓▓▓▓╖                \n" +
                          "             ▓▓▓█████▓▓▓▓▓▄███████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓                \n" +
                          "              ▓▓▓█████▓▓▓█████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓               \n" +
                          "               ╙▀█████████████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓               \n" +
                          "                   Y▓██████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓Ü              \n" +
                          "                   ,███████████▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓U              \n" +
                          "                   █████▓██████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓               \n" +
                          "                   ███▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓               \n" +
                          "                   ▓███▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓█▓▓▀               \n" +
                          "                  ]▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓█▓▓                \n" +
                          "                  ▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓▓▓▓▓                  \n" +
                          "                  ╙▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀                   \n" +
                          "                     - THE OFFICIAL ALF SEAL OF APPROVAL -\n" +
                         "                          developed by Simon Sessingø ");

            // Let people enjoy the title screen
            Thread.Sleep(4000);

            Console.Clear();

            Config.DefaultHealth = 999;

            Console.WindowHeight = defaultHeight;

            // Create new thread that listens for key inputs

            var keyboardThread = new Thread(StartKeyboardListener) {IsBackground = true};
            keyboardThread.Start();

            _memoryHandler = new ProcessMemoryHandler(Process.GetProcessesByName("csgo").FirstOrDefault());
            _memoryHandler.Open();

            // Create new thread that hacks the game
            var trainerThread = new Thread(GameTrainer) {IsBackground = true};
            trainerThread.Start();

            while (!_exit)
            {
                StringBuilder sf = new StringBuilder();
                sf.AppendLine("");
                sf.AppendLine("  [ CS-GO TRAINER ]  ");
                sf.AppendLine("");
                if (!_memoryHandler.Alive)
                {
                    sf.AppendLine("");
                    sf.AppendLine("  Please launch CS-GO...");
                    _memoryHandler.Process = Process.GetProcessesByName("csgo").FirstOrDefault();
                    _memoryHandler.Open();
                }
                else
                {
                    sf.AppendLine("  HP: " + Config.CurrentHealth);
                    sf.AppendLine("");

                    sf.AppendLine(String.Format("  KEY 1: {0} CUSTOM HEALTH (default set to: {1})", ((Config.EnableHealthHack) ? "Disable" : "Enables"), Config.DefaultHealth));

                    if (Config.EnableGodMode)
                    {
                        sf.AppendLine("  KEY 2: Disables GOD MODE");
                    }
                    else
                    {
                        sf.AppendLine("  KEY 2: Enables GOD MODE");
                    }

                    if (_defaultHealthEnter)
                    {
                        Console.WriteLine("");
                        Console.Write("  Enter custom health [1-999]: ");
                        int health;
                        if (int.TryParse(Console.ReadLine(), out health))
                        {
                            if (health > 0 && health <= 999)
                            {
                                _defaultHealthEnter = false;
                                Config.EnableHealthHack = true;
                                Config.DefaultHealth = health;
                            }
                        }
                    }

                }

                Console.Clear();

                Console.WriteLine(sf);
                Thread.Sleep(200);
            }
        }
コード例 #5
0
        internal unsafe void Initialize(Process process, ILogger logger)
        {
            this.logger = logger;
            if (process == null)
            {
                return; // Do not continue if this is null.
            }
            if (!SelectPointerAddresses(GameHashes.DetectVersion(process.MainModule.FileName)))
            {
                return; // Unknown version.
            }
            int pid = GetProcessId(process).Value;

            memoryAccess = new ProcessMemoryHandler(pid);
            if (ProcessRunning)
            {
                BaseAddress = NativeWrappers.GetProcessBaseAddress(pid, PInvoke.ListModules.LIST_MODULES_64BIT); // Bypass .NET's managed solution for getting this and attempt to get this info ourselves via PInvoke since some users are getting 299 PARTIAL COPY when they seemingly shouldn't.

                // Setup the pointers.
                //PointerPlayerHP = new MultilevelPointer(memoryAccess, IntPtr.Add(BaseAddress, pointerAddressHP), 0x58L, 0x18L, 0x18L, 0x78L, 0x68L, 0x48L);
                //PointerCurrentView = new MultilevelPointer(memoryAccess, IntPtr.Add(BaseAddress, pointerCurrentView), 0x58L);

                PointerEventActionType = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x38L,
                    0x50L
                    );

                PointerIsMotionPlay = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x38L
                    );

                PointerEventActionTask = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerEventActionTask),
                    0x58L,
                    0x60L,
                    0x40L,
                    0x80L,
                    0x10L,
                    0x10L,
                    0x20L,
                    0x28L
                    );

                PointerPlayerStatus = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L
                    );

                PointerPlayerHP = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x68L,
                    0x48L
                    );

                PointerPlayerPosition = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x78L,
                    0x50L
                    );

                PointerRankManager = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerRankManager)
                    );

                try
                {
                    PointerInventory = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerInventory),
                        0x60L,
                        0x18L,
                        0x10L
                        );

                    //Enemies
                    PointerEnemyEntryList = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerAddressEnemies),
                        0x58L,
                        0x10L
                        );

                    PointerEnemyCount = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerAddressEnemies),
                        0x58L,
                        0x10L
                        );

                    GenerateEnemyEntries();

                    //Items
                    PointerInventoryCount = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerInventory),
                        0x60L,
                        0x18L,
                        0x10L
                        );

                    PointerInventoryEntryList = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerAddressItems),
                        0x78L,
                        0x70L
                        );

                    GenerateItemEntries();
                }
                catch

                {
                    // May fail in main menu
                }
            }
        }
コード例 #6
0
        public unsafe bool SetField <T>(ProcessMemoryHandler processMemory, IntPtr pointer, ref T field, string name = null, params string[] properties)
            where T : unmanaged
        {
            T value = field;

            fixed(T *p = &field)
            {
                if (typeof(T) == typeof(byte))
                {
                    processMemory.TryGetByteAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(sbyte))
                {
                    processMemory.TryGetSByteAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(short))
                {
                    processMemory.TryGetShortAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(ushort))
                {
                    processMemory.TryGetUShortAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(int))
                {
                    processMemory.TryGetIntAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(uint))
                {
                    processMemory.TryGetUIntAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(long))
                {
                    processMemory.TryGetLongAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(ulong))
                {
                    processMemory.TryGetULongAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(float))
                {
                    processMemory.TryGetFloatAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(double))
                {
                    processMemory.TryGetDoubleAt(pointer, (IntPtr)p);
                }
                else if (typeof(T) == typeof(double))
                {
                    processMemory.TryGetDoubleAt(pointer, (IntPtr)p);
                }
            }

            if (EqualityComparer <T> .Default.Equals(field, value))
            {
                return(false);
            }

            SendUpdateEvent(name, properties);

            return(true);
        }