private void _updateUIThread_Tick(object sender, EventArgs e)
        {
            UpdateInfoLabels();

            if (!ProcUtils.ProcessIsRunning("csgo"))
            {
                Application.Current.Shutdown();
            }
        }
        /// <summary>
        /// Performs an DLL-injection
        /// </summary>
        /// <param name="pid">ID of the process to inject into</param>
        /// <param name="dllPath">Path of the DLL-file to inject</param>
        /// <returns>A DLLInjectionResult holding data about this injection-attempt</returns>
        public DllInjectionResult Inject(int pid, string dllPath, string moduleName = null)
        {
            if (pid < 0)
            {
                throw new ArgumentException("Process-ID is invalid", "pid");
            }
            if (!ProcUtils.ProcessIsRunning(pid))
            {
                throw new Exception(string.Format("Process with id {0} not found", pid));
            }

            return(Inject(Process.GetProcessById(pid), dllPath));
        }
        /// <summary>
        /// Performs an DLL-injection
        /// </summary>
        /// <param name="processName">Name of the process to inject into</param>
        /// <param name="dllPath">Path of the DLL-file to inject</param>
        /// <returns>A DLLInjectionResult holding data about this injection-attempt</returns>
        public DllInjectionResult Inject(string processName, string dllPath)
        {
            if (string.IsNullOrEmpty(processName))
            {
                throw new ArgumentException("String must not be null or empty", "processName");
            }
            if (!ProcUtils.ProcessIsRunning(processName))
            {
                throw new Exception(string.Format("Process \"{0}\" not found", processName));
            }

            return(Inject(Process.GetProcessesByName(processName)[0], dllPath));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Initialized(object sender, EventArgs e)
        {
            Closing += MainWindow_Closing;

            if (ProcUtils.ProcessIsRunning("csgo"))
            {
                Settings.Init();
                Memory.Init();
                Init();
                InitUI();
            }
            else
            {
                Application.Current.Shutdown();
            }
        }
        public static void Main(string[] args)
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);

            PrintSuccess("[>]=-- Zat's CSGO-ESP");
            PrintEncolored("[www.unknowncheats.me - Leading the game hacking scene since 2000]", ConsoleColor.Cyan);
            Thread scroller = new Thread(new ThreadStart(LoopScroll));

            scroller.IsBackground = true;
            scroller.Start();
            KeyUtils    = new KeyUtils();
            ConfigUtils = new CSGOConfigUtils();

            //ESP
            ConfigUtils.BooleanSettings.AddRange(new string[] { "espEnabled", "espBox", "espSkeleton", "espName", "espHealth", "espAllies", "espEnemies" });
            //Aim
            ConfigUtils.BooleanSettings.AddRange(new string[] { "aimDrawFov", "aimEnabled", "aimToggle", "aimHold", "aimSmoothEnabled", "aimFilterSpotted", "aimFilterSpottedBy", "aimFilterEnemies", "aimFilterAllies", "aimFilterSpottedBy" });
            ConfigUtils.KeySettings.Add("aimKey");
            ConfigUtils.FloatSettings.AddRange(new string[] { "aimFov", "aimSmoothValue" });
            ConfigUtils.IntegerSettings.Add("aimBone");
            //RCS
            ConfigUtils.BooleanSettings.Add("rcsEnabled");
            ConfigUtils.FloatSettings.Add("rcsForce");
            //Trigger
            ConfigUtils.BooleanSettings.AddRange(new string[] { "triggerEnabled", "triggerToggle", "triggerHold", "triggerFilterEnemies", "triggerFilterAllies", "triggerBurstEnabled", "triggerBurstRandomize" });
            ConfigUtils.KeySettings.Add("triggerKey");
            ConfigUtils.FloatSettings.AddRange(new string[] { "triggerDelayFirstShot", "triggerDelayShots", "triggerBurstShots" });
            //Radar
            ConfigUtils.BooleanSettings.AddRange(new string[] { "radarEnabled", "radarAllies", "radarEnemies" });
            ConfigUtils.FloatSettings.AddRange(new string[] { "radarScale", "radarWidth", "radarHeight" });
            //Crosshair
            ConfigUtils.BooleanSettings.AddRange(new string[] { "crosshairEnabled", "crosshairOutline" });
            ConfigUtils.IntegerSettings.AddRange(new string[] { "crosshairType" });
            ConfigUtils.UIntegerSettings.AddRange(new string[] { "crosshairPrimaryColor", "crosshairSecondaryColor" });
            ConfigUtils.FloatSettings.AddRange(new string[] { "crosshairWidth", "crosshairSpreadScale", "crosshairRadius" });
            //Windows
            ConfigUtils.BooleanSettings.AddRange(new string[] { "windowSpectatorsEnabled", "windowPerformanceEnabled", "windowBotsEnabled", "windowEnemiesEnabled" });


            ConfigUtils.FillDefaultValues();

            if (!File.Exists("euc_csgo.cfg"))
            {
                ConfigUtils.SaveSettingsToFile("euc_csgo.cfg");
            }
            ConfigUtils.ReadSettingsFromFile("euc_csgo.cfg");

            PrintInfo("> Waiting for CSGO to start up...");
            while (!ProcUtils.ProcessIsRunning(GAME_PROCESS))
            {
                Thread.Sleep(250);
            }

            ProcUtils       = new ProcUtils(GAME_PROCESS, WinAPI.ProcessAccessFlags.VirtualMemoryRead | WinAPI.ProcessAccessFlags.VirtualMemoryWrite | WinAPI.ProcessAccessFlags.VirtualMemoryOperation);
            MemUtils        = new ExternalUtilsCSharp.MemUtils();
            MemUtils.Handle = ProcUtils.Handle;

            PrintInfo("> Waiting for CSGOs window to show up...");
            while ((hWnd = WinAPI.FindWindowByCaption(hWnd, GAME_TITLE)) == IntPtr.Zero)
            {
                Thread.Sleep(250);
            }

            ProcessModule clientDll, engineDll;

            PrintInfo("> Waiting for CSGO to load client.dll...");
            while ((clientDll = ProcUtils.GetModuleByName(@"bin\client.dll")) == null)
            {
                Thread.Sleep(250);
            }
            PrintInfo("> Waiting for CSGO to load engine.dll...");
            while ((engineDll = ProcUtils.GetModuleByName(@"engine.dll")) == null)
            {
                Thread.Sleep(250);
            }

            Framework = new Framework(clientDll, engineDll);

            PrintInfo("> Initializing overlay");
            using (SHDXOverlay = new SharpDXOverlay())
            {
                SHDXOverlay.Attach(hWnd);
                SHDXOverlay.TickEvent          += overlay_TickEvent;
                SHDXOverlay.BeforeDrawingEvent += SHDXOverlay_BeforeDrawingEvent;
                InitializeComponents();
                SharpDXRenderer renderer  = SHDXOverlay.Renderer;
                TextFormat      smallFont = renderer.CreateFont("smallFont", "Century Gothic", 10f);
                TextFormat      largeFont = renderer.CreateFont("largeFont", "Century Gothic", 14f);
                TextFormat      heavyFont = renderer.CreateFont("heavyFont", "Century Gothic", 14f, FontStyle.Normal, FontWeight.Heavy);

                windowMenu.Font               = smallFont;
                windowMenu.Caption.Font       = largeFont;
                windowGraphs.Font             = smallFont;
                windowGraphs.Caption.Font     = largeFont;
                windowSpectators.Font         = smallFont;
                windowSpectators.Caption.Font = largeFont;
                windowBots.Font               = smallFont;
                windowBots.Caption.Font       = largeFont;
                graphMemRead.Font             = smallFont;
                graphMemWrite.Font            = smallFont;

                for (int i = 0; i < ctrlPlayerESP.Length; i++)
                {
                    ctrlPlayerESP[i].Font = heavyFont;
                    SHDXOverlay.ChildControls.Add(ctrlPlayerESP[i]);
                }
                ctrlRadar.Font = smallFont;

                windowMenu.ApplySettings(ConfigUtils);

                SHDXOverlay.ChildControls.Add(ctrlCrosshair);
                SHDXOverlay.ChildControls.Add(ctrlRadar);
                SHDXOverlay.ChildControls.Add(windowMenu);
                SHDXOverlay.ChildControls.Add(windowGraphs);
                SHDXOverlay.ChildControls.Add(windowSpectators);
                SHDXOverlay.ChildControls.Add(windowBots);
                SHDXOverlay.ChildControls.Add(cursor);
                PrintInfo("> Running overlay");
                System.Windows.Forms.Application.Run(SHDXOverlay);
            }
            ConfigUtils.SaveSettingsToFile("euc_csgo.cfg");
        }
Beispiel #6
0
        public void Update()
        {
            //If the game processes is not running, close the cheat.
            if (!ProcUtils.ProcessIsRunning(Program.GameProcess))
            {
                Environment.Exit(0);
            }

            WindowTitle = GetActiveWindowTitle();
            if (WindowTitle != Program.GameTitle)
            {
                return;
            }

            var players  = new List <Tuple <int, Player> >();
            var entities = new List <Tuple <int, BaseEntity> >();
            var weapons  = new List <Tuple <int, Weapon> >();

            State        = (SignOnState)Program.MemUtils.Read <int>((IntPtr)(ClientState + Offsets.ClientState.InGame));
            _localPlayer = Program.MemUtils.Read <int>((IntPtr)(ClientDllBase + Offsets.Misc.LocalPlayer));
            ViewMatrix   = Program.MemUtils.ReadMatrix((IntPtr)_viewMatrix, 4, 4);


            //If we are not ingame do not update
            if (State != SignOnState.SignonstateFull)
            {
                return;
            }

            var data = new byte[16 * 8192];

            Program.MemUtils.Read((IntPtr)_entityList, out data, data.Length);

            for (var i = 0; i < data.Length / 16; i++)
            {
                var address = BitConverter.ToInt32(data, 16 * i);
                if (address == 0)
                {
                    continue;
                }
                var entity = new BaseEntity(address);
                if (!entity.IsValid())
                {
                    continue;
                }
                if (entity.IsPlayer())
                {
                    players.Add(new Tuple <int, Player>(i, new Player(entity)));
                }
                else if (entity.IsWeapon())
                {
                    weapons.Add(new Tuple <int, Weapon>(i, new Weapon(entity)));
                }
                else
                {
                    entities.Add(new Tuple <int, BaseEntity>(i, entity));
                }
            }

            Players  = players.ToArray();
            Entities = entities.ToArray();
            Weapons  = weapons.ToArray();

            //Check if our player exists
            if (players.Exists(x => x.Item2.Address == _localPlayer))
            {
                LocalPlayer       = new LocalPlayer(players.First(x => x.Item2.Address == _localPlayer).Item2);
                LocalPlayerWeapon = LocalPlayer.GetActiveWeapon();
                //Only gets the weapon name and formates it properly and retunrs a string. Used for Weapon Configs
                WeaponSection = LocalPlayer.GetActiveWeaponName();
            }
        }