private static void AttachToGame() { Process process; Console.WriteNotification($"\n Looking for {Phoenix.GameName}..."); while (Memory == null) { Thread.Sleep(100); try { process = Process.GetProcessesByName(Phoenix.ProcessName).FirstOrDefault(p => p.Threads.Count > 0); if (process == null || !Utils.IsModuleLoaded(process, "client.dll") || !Utils.IsModuleLoaded(process, "engine.dll")) { continue; } } catch { continue; } Phoenix.Memory = new ProcessMemory(process); Console.WriteLine("\n Modules:"); Console.WriteSuccess(" \tclient.dll | 0x" + Memory["client.dll"].BaseAddress.ToString("X").PadLeft(8, '0') + "\t| " + Utils.ByteSizeToString(Memory["client.dll"].ModuleMemorySize)); Console.WriteSuccess(" \tengine.dll | 0x" + Memory["engine.dll"].BaseAddress.ToString("X").PadLeft(8, '0') + "\t| " + Utils.ByteSizeToString(Memory["engine.dll"].ModuleMemorySize)); Phoenix.Client = new PatternScan(process, "client.dll"); Phoenix.Engine = new PatternScan(process, "engine.dll"); } Console.WriteLine("\n Offsets:"); Console.WriteOffset("EntityBase", SignatureManager.GetEntityList()); Console.WriteOffset("ClientClass", SignatureManager.GetClientClassesHead()); Console.WriteOffset("ClientState", SignatureManager.GetClientState()); Console.WriteOffset("GameDirectory", SignatureManager.GetGameDir()); Console.WriteOffset("ViewMatrix", SignatureManager.GetWorldToViewMatrix()); Console.WriteOffset("ViewAngle", SignatureManager.GetViewAngle(), true); Phoenix.NetVars = new Dictionary <string, System.IntPtr>(); Console.WriteLine("\n NetVars:"); Phoenix.NetVars.Add("m_vecAimPunch", NetvarManager.GetOffset("DT_BasePlayer", "m_Local") + 0x6C); Phoenix.NetVars.Add("m_vecOrigin", NetvarManager.GetOffset("DT_BasePlayer", "m_vecOrigin")); Phoenix.NetVars.Add("m_iHealth", NetvarManager.GetOffset("DT_BasePlayer", "m_iHealth")); Phoenix.NetVars.Add("m_iTeamNum", NetvarManager.GetOffset("DT_BasePlayer", "m_iTeamNum")); Phoenix.NetVars.Add("m_vecViewOffset", NetvarManager.GetOffset("DT_BasePlayer", "m_vecViewOffset[0]")); Phoenix.NetVars.Add("m_dwIndex", SignatureManager.GetIndexOffset()); Phoenix.NetVars.Add("m_dwBoneMatrix", new System.IntPtr(0x810)); Phoenix.NetVars.Add("m_hActiveWeapon", NetvarManager.GetOffset("DT_BasePlayer", "m_hActiveWeapon")); Phoenix.NetVars.Add("m_hViewModel", NetvarManager.GetOffset("DT_BasePlayer", "m_hViewModel[0]")); Phoenix.NetVars.Add("m_hOwner", NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_hOwner")); Phoenix.NetVars.Add("m_iState", NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_iState")); Phoenix.NetVars.Add("m_nModelIndex", NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_nModelIndex")); Phoenix.NetVars.Add("m_bDormant", SignatureManager.GetDormantOffset()); Phoenix.NetVars.Add("m_flFlashAlpha", NetvarManager.GetOffset("DT_CSPlayer", "m_flFlashMaxAlpha")); Phoenix.NetVars.Add("m_iFOVStart", NetvarManager.GetOffset("DT_CSPlayer", "m_iFOVStart")); Phoenix.NetVars.Add("m_bIsDefusing", NetvarManager.GetOffset("DT_CSPlayer", "m_bIsDefusing")); Phoenix.NetVars.Add("m_fFlags", NetvarManager.GetOffset("DT_CSPlayer", "m_fFlags")); Phoenix.NetVars.Add("m_hMyWeapons", NetvarManager.GetOffset("DT_CSPlayer", "m_hMyWeapons")); Phoenix.NetVars.Add("m_hWeapon", NetvarManager.GetOffset("DT_BaseViewModel", "m_hWeapon")); Phoenix.NetVars.Add("m_lifeState", NetvarManager.GetOffset("DT_BasePlayer", "m_lifeState")); Phoenix.NetVars.Add("m_iClip1", NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_iClip1")); Phoenix.NetVars.Add("m_vecMins", NetvarManager.GetOffset("DT_BaseEntity", "m_Collision") + 0x20); Phoenix.NetVars.Add("m_vecMaxs", NetvarManager.GetOffset("DT_BaseEntity", "m_Collision") + 0x2C); Phoenix.NetVars.Sort(); foreach (var netvar in Phoenix.NetVars) { Console.WriteOffset(netvar.Key, netvar.Value, true); } Console.WriteOffset("m_numHighest", (System.IntPtr)Phoenix.NetVars.MaxValue() + Marshal.SizeOf(typeof(Vector3D)), true); Console.WriteNotification("\n Found and attached to it!"); CommandHandler.Load(); Console.WriteCommandLine(); ThreadManager.RunAll(); }
private static void AttachToGame() { Console.WriteNotification($"\n Looking for {ExternalCounterstrike.GameName}..."); while (!ExternalCounterstrike.IsAttached) { Thread.Sleep(100); try { ExternalCounterstrike.Process = Process.GetProcessesByName(ExternalCounterstrike.ProcessName).FirstOrDefault(p => p.Threads.Count > 0); if (ExternalCounterstrike.Process == null || !Utils.IsModuleLoaded(ExternalCounterstrike.Process, "client.dll") || !Utils.IsModuleLoaded(ExternalCounterstrike.Process, "engine.dll")) { continue; } } catch { continue; } while (ExternalCounterstrike.ClientDll == null) { Thread.Sleep(100); ExternalCounterstrike.ClientDll = Utils.GetModuleHandle(ExternalCounterstrike.Process, "client.dll"); } while (ExternalCounterstrike.EngineDll == null) { Thread.Sleep(100); ExternalCounterstrike.EngineDll = Utils.GetModuleHandle(ExternalCounterstrike.Process, "engine.dll"); } ExternalCounterstrike.Memory = new MemoryScanner(ExternalCounterstrike.Process); ExternalCounterstrike.SigScanner = new SignatureScanner(ExternalCounterstrike.Process); ExternalCounterstrike.IsAttached = true; } Console.WriteLine("\n Modules:"); Console.WriteSuccess(" \tclient.dll | 0x" + ExternalCounterstrike.ClientDll.BaseAddress.ToString("X").PadLeft(8, '0') + "\t| " + Utils.ByteSizeToString(ExternalCounterstrike.ClientDll.ModuleMemorySize)); Console.WriteSuccess(" \tengine.dll | 0x" + ExternalCounterstrike.EngineDll.BaseAddress.ToString("X").PadLeft(8, '0') + "\t| " + Utils.ByteSizeToString(ExternalCounterstrike.EngineDll.ModuleMemorySize)); Console.WriteLine("\n Offsets:"); Console.WriteOffset("EntityBase", 0x04A4BA64); Console.WriteLine("\n NetVars:"); ExternalCounterstrike.NetVars = new SortedDictionary <string, int>(); ExternalCounterstrike.NetVars.Add("m_aimPunchAngle", NetvarManager.GetOffset("DT_BasePlayer", "m_Local") + NetvarManager.GetOffset("DT_BasePlayer", "m_aimPunchAngle")); ExternalCounterstrike.NetVars.Add("m_vecOrigin", NetvarManager.GetOffset("DT_BasePlayer", "m_vecOrigin")); ExternalCounterstrike.NetVars.Add("m_iHealth", NetvarManager.GetOffset("DT_BasePlayer", "m_iHealth")); ExternalCounterstrike.NetVars.Add("m_iTeamNum", NetvarManager.GetOffset("DT_BasePlayer", "m_iTeamNum")); ExternalCounterstrike.NetVars.Add("m_vecViewOffset", NetvarManager.GetOffset("DT_BasePlayer", "m_vecViewOffset[0]")); ExternalCounterstrike.NetVars.Add("m_dwIndex", 0x64); ExternalCounterstrike.NetVars.Add("m_dwBoneMatrix", NetvarManager.GetOffset("DT_BaseAnimating", "m_nForceBone") + 0x1C); var m_bDormant = SignatureManager.GetDormantOffset(); ExternalCounterstrike.NetVars.Add("m_bDormant", m_bDormant); var sortedDict = from entry in ExternalCounterstrike.NetVars orderby entry.Value ascending select entry; foreach (var netvar in sortedDict) { Console.WriteOffset(netvar.Key, netvar.Value); } Console.WriteOffset("m_numHighest", ExternalCounterstrike.NetVars.Values.Max()); Console.WriteNotification("\n Found and attached to it!\n"); Console.WriteCommandLine(); ThreadManager.Run("CommandHandler"); ThreadManager.Run("Example"); }
private static void AttachToGame() { Console.WriteNotification($"\n Looking for {ExternalCounterstrike.GameName}..."); while (!ExternalCounterstrike.IsAttached) { Thread.Sleep(100); try { ExternalCounterstrike.Process = Process.GetProcessesByName(ExternalCounterstrike.ProcessName).FirstOrDefault(p => p.Threads.Count > 0); if (ExternalCounterstrike.Process == null || !Utils.IsModuleLoaded(ExternalCounterstrike.Process, "client.dll") || !Utils.IsModuleLoaded(ExternalCounterstrike.Process, "engine.dll")) { continue; } } catch { continue; } Console.WriteLine("\n Modules:"); while (ExternalCounterstrike.ClientDll == null) { Thread.Sleep(100); ExternalCounterstrike.ClientDll = Utils.GetModuleHandle(ExternalCounterstrike.Process, "client.dll"); } Console.WriteSuccess(" \tclient.dll | 0x" + ExternalCounterstrike.ClientDll.BaseAddress.ToString("X").PadLeft(8, '0') + "\t| " + Utils.ByteSizeToString(ExternalCounterstrike.ClientDll.ModuleMemorySize)); while (ExternalCounterstrike.EngineDll == null) { Thread.Sleep(100); ExternalCounterstrike.EngineDll = Utils.GetModuleHandle(ExternalCounterstrike.Process, "engine.dll"); } Console.WriteSuccess(" \tengine.dll | 0x" + ExternalCounterstrike.EngineDll.BaseAddress.ToString("X").PadLeft(8, '0') + "\t| " + Utils.ByteSizeToString(ExternalCounterstrike.EngineDll.ModuleMemorySize)); ExternalCounterstrike.Memory = new MemoryScanner(ExternalCounterstrike.Process); ExternalCounterstrike.SigScanner = new SignatureScanner(ExternalCounterstrike.Process); ExternalCounterstrike.Overlay = new OverlayWindow(ExternalCounterstrike.Process.MainWindowHandle, false); ExternalCounterstrike.IsAttached = true; } Console.WriteLine("\n Offsets:"); Console.WriteOffset("EntityBase", SignatureManager.GetEntityList()); Console.WriteOffset("ConCommand", SignatureManager.GetConvarPtr()); Console.WriteLine("\n NetVars:"); ExternalCounterstrike.NetVars = new SortedDictionary <string, int>(); var attribute = NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_Item") + NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_AttributeManager"); ExternalCounterstrike.NetVars.Add("m_vecAimPunch", NetvarManager.GetOffset("DT_BasePlayer", "m_Local") + NetvarManager.GetOffset("DT_BasePlayer", "m_aimPunchAngle")); ExternalCounterstrike.NetVars.Add("m_vecViewPunch", NetvarManager.GetOffset("DT_BasePlayer", "m_Local") + NetvarManager.GetOffset("DT_BasePlayer", "m_viewPunchAngle")); ExternalCounterstrike.NetVars.Add("m_ItemDefIndex", attribute + NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_iItemDefinitionIndex")); ExternalCounterstrike.NetVars.Add("m_vecOrigin", NetvarManager.GetOffset("DT_BasePlayer", "m_vecOrigin")); ExternalCounterstrike.NetVars.Add("m_iHealth", NetvarManager.GetOffset("DT_BasePlayer", "m_iHealth")); ExternalCounterstrike.NetVars.Add("m_iTeamNum", NetvarManager.GetOffset("DT_BasePlayer", "m_iTeamNum")); ExternalCounterstrike.NetVars.Add("m_vecViewOffset", NetvarManager.GetOffset("DT_BasePlayer", "m_vecViewOffset[0]")); ExternalCounterstrike.NetVars.Add("m_dwIndex", 0x64); ExternalCounterstrike.NetVars.Add("m_dwBoneMatrix", NetvarManager.GetOffset("DT_BaseAnimating", "m_nForceBone") + 0x1C); ExternalCounterstrike.NetVars.Add("m_hActiveWeapon", NetvarManager.GetOffset("DT_BasePlayer", "m_hActiveWeapon")); ExternalCounterstrike.NetVars.Add("m_hOwner", NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_hOwner")); ExternalCounterstrike.NetVars.Add("m_bDormant", SignatureManager.GetDormantOffset()); ExternalCounterstrike.NetVars.Add("m_nPaintKit", NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_nFallbackPaintKit")); ExternalCounterstrike.NetVars.Add("m_iItemIDHigh", attribute + NetvarManager.GetOffset("DT_BaseCombatWeapon", "m_iItemIDHigh")); ExternalCounterstrike.NetVars.Add("m_flFlashAlpha", NetvarManager.GetOffset("DT_CSPlayer", "m_flFlashMaxAlpha")); var sortedDict = from entry in ExternalCounterstrike.NetVars orderby entry.Value ascending select entry; foreach (var netvar in sortedDict) { Console.WriteOffset(netvar.Key, netvar.Value, true); } Console.WriteOffset("m_numHighest", ExternalCounterstrike.NetVars.Values.Max() + Marshal.SizeOf(typeof(Vector3D)), true); Console.WriteNotification("\n Found and attached to it!\n"); Console.WriteCommandLine(); ThreadManager.Run("CommandHandler"); ThreadManager.Run("DrawingLoop"); //ThreadManager.Run("SkinChanger"); }