From 96a378be0b59b4bd54ab4ac034548d1aaa01f2fb Mon Sep 17 00:00:00 2001 From: a2x <45197573+a2x@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:46:03 +1000 Subject: [PATCH] Added new patterns --- config.json | 46 +++++++++++++++++++++++++++++++++---- generated/offsets.cs | 4 +++- generated/offsets.hpp | 4 +++- generated/offsets.json | 2 ++ generated/offsets.rs | 4 +++- src/config.rs | 10 +++++---- src/dumpers/offsets.rs | 51 ++++++++++++++++++++++++------------------ src/mem/address.rs | 8 +++---- 8 files changed, 92 insertions(+), 37 deletions(-) diff --git a/config.json b/config.json index 075437fe..b7af19a8 100644 --- a/config.json +++ b/config.json @@ -116,6 +116,26 @@ } ] }, + { + "name": "dwGlowManager", + "module": "client.dll", + "pattern": "48 8D 0D ? ? ? ? E9 2D EE FC 00", + "operations": [ + { + "type": "ripRelative" + }, + { + "type": "dereference" + }, + { + "type": "add", + "value": 112 + }, + { + "type": "dereference" + } + ] + }, { "name": "dwInterfaceLinkList", "module": "client.dll", @@ -160,14 +180,31 @@ } ] }, + { + "name": "dwNetworkGameClient_getLocalPlayer", + "module": "engine2.dll", + "pattern": "48 83 C0 ? 48 8D 04 40 8B 0C C1", + "operations": [ + { + "type": "slice", + "start": 3, + "end": 4 + }, + { + "type": "add", + "value": 230 + } + ] + }, { "name": "dwNetworkGameClient_maxClients", "module": "engine2.dll", "pattern": "8B 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC CC 48 8D 81", "operations": [ { - "type": "offset", - "offset": 2 + "type": "slice", + "start": 2, + "end": 4 } ] }, @@ -177,8 +214,9 @@ "pattern": "44 8B 81 ? ? ? ? 48 8D 0D", "operations": [ { - "type": "offset", - "offset": 3 + "type": "slice", + "start": 3, + "end": 5 } ] }, diff --git a/generated/offsets.cs b/generated/offsets.cs index d6d66ac8..3e2c68c1 100644 --- a/generated/offsets.cs +++ b/generated/offsets.cs @@ -1,5 +1,5 @@ // Created using https://github.com/a2x/cs2-dumper -// 2023-10-07 01:42:59.790798200 UTC +// 2023-10-09 05:41:44.460863500 UTC public static class client_dll { public const nint dwEntityList = 0x17888D8; @@ -10,6 +10,7 @@ public static class client_dll { public const nint dwForceLeft = 0x168FF50; public const nint dwForceRight = 0x168FFE0; public const nint dwGlobalVars = 0x168BCE8; + public const nint dwGlowManager = 0x17E3C00; public const nint dwInterfaceLinkList = 0x196EC98; public const nint dwLocalPlayerController = 0x17D7158; public const nint dwLocalPlayerPawn = 0x1875C48; @@ -22,6 +23,7 @@ public static class client_dll { public static class engine2_dll { public const nint dwBuildNumber = 0x486514; public const nint dwNetworkGameClient = 0x485AB0; + public const nint dwNetworkGameClient_getLocalPlayer = 0xF0; public const nint dwNetworkGameClient_maxClients = 0x250; public const nint dwNetworkGameClient_signOnState = 0x240; public const nint dwWindowHeight = 0x5376AC; diff --git a/generated/offsets.hpp b/generated/offsets.hpp index 223a03f1..f28f539a 100644 --- a/generated/offsets.hpp +++ b/generated/offsets.hpp @@ -3,7 +3,7 @@ #include // Created using https://github.com/a2x/cs2-dumper -// 2023-10-07 01:42:59.789624800 UTC +// 2023-10-09 05:41:44.460417200 UTC namespace client_dll { constexpr std::ptrdiff_t dwEntityList = 0x17888D8; @@ -14,6 +14,7 @@ namespace client_dll { constexpr std::ptrdiff_t dwForceLeft = 0x168FF50; constexpr std::ptrdiff_t dwForceRight = 0x168FFE0; constexpr std::ptrdiff_t dwGlobalVars = 0x168BCE8; + constexpr std::ptrdiff_t dwGlowManager = 0x17E3C00; constexpr std::ptrdiff_t dwInterfaceLinkList = 0x196EC98; constexpr std::ptrdiff_t dwLocalPlayerController = 0x17D7158; constexpr std::ptrdiff_t dwLocalPlayerPawn = 0x1875C48; @@ -26,6 +27,7 @@ namespace client_dll { namespace engine2_dll { constexpr std::ptrdiff_t dwBuildNumber = 0x486514; constexpr std::ptrdiff_t dwNetworkGameClient = 0x485AB0; + constexpr std::ptrdiff_t dwNetworkGameClient_getLocalPlayer = 0xF0; constexpr std::ptrdiff_t dwNetworkGameClient_maxClients = 0x250; constexpr std::ptrdiff_t dwNetworkGameClient_signOnState = 0x240; constexpr std::ptrdiff_t dwWindowHeight = 0x5376AC; diff --git a/generated/offsets.json b/generated/offsets.json index 7852a0c2..163d8b01 100644 --- a/generated/offsets.json +++ b/generated/offsets.json @@ -8,6 +8,7 @@ "dwForceLeft": 23658320, "dwForceRight": 23658464, "dwGlobalVars": 23641320, + "dwGlowManager": 25050112, "dwInterfaceLinkList": 26668184, "dwLocalPlayerController": 24998232, "dwLocalPlayerPawn": 25648200, @@ -19,6 +20,7 @@ "engine2_dll": { "dwBuildNumber": 4744468, "dwNetworkGameClient": 4741808, + "dwNetworkGameClient_getLocalPlayer": 240, "dwNetworkGameClient_maxClients": 592, "dwNetworkGameClient_signOnState": 576, "dwWindowHeight": 5469868, diff --git a/generated/offsets.rs b/generated/offsets.rs index abf9dd64..fc26cc1a 100644 --- a/generated/offsets.rs +++ b/generated/offsets.rs @@ -1,7 +1,7 @@ #![allow(non_snake_case, non_upper_case_globals)] // Created using https://github.com/a2x/cs2-dumper -// 2023-10-07 01:42:59.792129600 UTC +// 2023-10-09 05:41:44.461556800 UTC pub mod client_dll { pub const dwEntityList: usize = 0x17888D8; @@ -12,6 +12,7 @@ pub mod client_dll { pub const dwForceLeft: usize = 0x168FF50; pub const dwForceRight: usize = 0x168FFE0; pub const dwGlobalVars: usize = 0x168BCE8; + pub const dwGlowManager: usize = 0x17E3C00; pub const dwInterfaceLinkList: usize = 0x196EC98; pub const dwLocalPlayerController: usize = 0x17D7158; pub const dwLocalPlayerPawn: usize = 0x1875C48; @@ -24,6 +25,7 @@ pub mod client_dll { pub mod engine2_dll { pub const dwBuildNumber: usize = 0x486514; pub const dwNetworkGameClient: usize = 0x485AB0; + pub const dwNetworkGameClient_getLocalPlayer: usize = 0xF0; pub const dwNetworkGameClient_maxClients: usize = 0x250; pub const dwNetworkGameClient_signOnState: usize = 0x240; pub const dwWindowHeight: usize = 0x5376AC; diff --git a/src/config.rs b/src/config.rs index df63ff23..3ac91863 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,19 +7,21 @@ pub enum Operation { value: usize, }, Dereference { - times: Option, + times: Option, + size: Option, }, Jmp { offset: Option, length: Option, }, - Offset { - offset: usize, - }, RipRelative { offset: Option, length: Option, }, + Slice { + start: usize, + end: usize, + }, Subtract { value: usize, }, diff --git a/src/dumpers/offsets.rs b/src/dumpers/offsets.rs index 8173dd87..8128d318 100644 --- a/src/dumpers/offsets.rs +++ b/src/dumpers/offsets.rs @@ -24,49 +24,56 @@ pub fn dump_offsets(builders: &mut Vec, process: &Process) -> R let mut address = Address::from(process.find_pattern(&signature.module, &signature.pattern)?); - let mut offset: Option = None; - for operation in signature.operations { match operation { - Add { value } => { - address += value; - } - Dereference { times } => { - for _ in 0..times.unwrap_or(1) { - address = process.read_memory::(address.0)?.into(); + Add { value } => address += value, + Dereference { times, size } => { + let times = times.unwrap_or(1); + let size = size.unwrap_or(8); + + for _ in 0..times { + process.read_memory_raw( + address.0, + &mut address.0 as *mut _ as *mut _, + size, + )?; } } Jmp { offset, length } => { - address = process.resolve_jmp(address.0, offset, length)?.into(); - } - Offset { - offset: start_offset, - } => { - offset = Some(process.read_memory::(address.0 + start_offset)?); + address = process.resolve_jmp(address.0, offset, length)?.into() } RipRelative { offset, length } => { - address = process.resolve_rip(address.0, offset, length)?.into(); + address = process.resolve_rip(address.0, offset, length)?.into() } - Subtract { value } => { - address -= value; + Slice { start, end } => { + let mut result: usize = 0; + + process.read_memory_raw( + address.add(start).0, + &mut result as *mut _ as *mut _, + end - start, + )?; + + address = result.into(); } + Subtract { value } => address -= value, } } - let (name, value) = if let Some(offset) = offset { - log::debug!(" └─ {} @ {:#X}", signature.name, offset); + let (name, value) = if address.0 < module.address() { + log::debug!(" └─ {} @ {:#X}", signature.name, address.0); - (signature.name, offset as usize) + (signature.name, address.0) } else { log::debug!( " └─ {} @ {:#X} ({} + {:#X})", signature.name, address, signature.module, - address - module.address() + address.sub(module.address()) ); - (signature.name, address.0 - module.address()) + (signature.name, address.sub(module.address()).0) }; entries diff --git a/src/mem/address.rs b/src/mem/address.rs index 515c4ca6..eab90749 100644 --- a/src/mem/address.rs +++ b/src/mem/address.rs @@ -6,12 +6,12 @@ use std::ops::{Add, AddAssign, Sub, SubAssign}; pub struct Address(pub usize); impl Address { - pub fn add(&self, offset: usize) -> Self { - Self(self.0 + offset) + pub fn add(&self, value: usize) -> Self { + Self(self.0 + value) } - pub fn sub(&self, offset: usize) -> Self { - Self(self.0 - offset) + pub fn sub(&self, value: usize) -> Self { + Self(self.0 - value) } pub fn as_ptr(&self) -> *const T {