/// <summary> /// Initializes a new instance of the <see cref="ProcessSharp" /> class. /// </summary> /// <param name="native">The native process.</param> /// <param name="type">The type of memory being manipulated.</param> public ProcessSharp(Process native, MemoryType type) { native.EnableRaisingEvents = true; native.Exited += (s, e) => { ProcessExited?.Invoke(s, e); HandleProcessExiting(); }; Native = native; Handle = MemoryHelper.OpenProcess(ProcessAccessFlags.AllAccess, Native.Id); switch (type) { case MemoryType.Local: Memory = new LocalProcessMemory(Handle); break; case MemoryType.Remote: Memory = new ExternalProcessMemory(Handle); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } native.ErrorDataReceived += OutputDataReceived; native.OutputDataReceived += OutputDataReceived; ThreadFactory = new ThreadFactory(this); ModuleFactory = new ModuleFactory(this); MemoryFactory = new MemoryFactory(this); WindowFactory = new WindowFactory(this); }
/// <summary> /// Initializes Orion by attaching to the specified CSGO process. /// </summary> /// <param name="process">The process.</param> /// <param name="isInjected">if set to <c>true</c> [is injected].</param> public static void Attach(Process process, bool isInjected = false) { if (_isAttached) { return; } // We won't require the injector for now - we're completely passive. if (isInjected) { Memory = new LocalProcessMemory(process); } else { Memory = new ExternalProcessMemory(process); } ClientBase = Memory.GetModule("client.dll").BaseAddress; EngineBase = Memory.GetModule("engine.dll").BaseAddress; ClientSize = Memory.GetModule("client.dll").ModuleMemorySize; EngineSize = Memory.GetModule("engine.dll").ModuleMemorySize; BaseOffsets.Init(); _log.Debug($"Client Base Address: 0x{ClientBase}"); _log.Debug($"Engine Base Address: 0x{EngineBase}"); //Patchables.BaseOffsets.Initialize(); _log.Info("Initializing ObjectManager.."); Objects = new ObjectManager(ClientBase + (int)BaseOffsets.EntityList, 128); GlowObjects = new GlowManager(ClientBase + (int)BaseOffsets.GlowObjBase); var clientState = Memory.Read <IntPtr>(EngineBase + (int)BaseOffsets.ClientState); _log.Debug($"Engine Pointer: 0x{clientState}"); if (clientState == IntPtr.Zero) { throw new Exception("Couldn't find Engine Ptr - are you sure your offsets are up to date?"); } _log.Info("Initializing GameClient.."); Client = new GameClient(clientState); _log.Debug($"Orion attached successfully to process with ID {process.Id}."); _isAttached = true; }
public static void Attach(System.Diagnostics.Process process, bool isInjected = false) { if (_isAttached) { return; } if (isInjected) { Memory = new LocalProcessMemory(process); } else { Memory = new ExternalProcessMemory(process); } Thread.Sleep(2000); Renderer = new Renderer(process); ClientBase = Memory.GetModule("client.dll").BaseAddress; EngineBase = Memory.GetModule("engine.dll").BaseAddress; Offsets.Initialize(); ClientState = Memory.Read <int>(EngineBase + Offsets.ClientState.Base); Objects = new ObjectManager(ClientBase + Offsets.Misc.EntityList); Box = new Box(); HeadHelper = new HeadHelper(); SkinChanger = new SkinChanger(); ControlRecoil = new Rcs(); TriggerBot = new TriggerBot(); KeyUtils = new KeyUtils(); BunnyJump = new BunnyJump(); SoundEsp = new SoundEsp(); Radar = new Radar(); NoFlash = new NoFlash(); AutoPistol = new AutoPistol(); Glow = new Glow(); AimAssist = new AimAssist(); var enginePtr = Memory.Read <IntPtr>(EngineBase + Offsets.ClientState.Base); if (enginePtr == IntPtr.Zero) { throw new Exception("Couldn't find Engine Ptr - are you sure your offsets are up to date?"); } Client = new GameClient(enginePtr); _isAttached = true; }
public void CreateWithInjector() { var lpm = new LocalProcessMemory(Process.GetCurrentProcess(), new InjectorCreationOptions(true, true)); }