mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-10-07 16:30:01 +08:00
📦 Game Update 13970
This commit is contained in:
@@ -4,23 +4,21 @@ use serde::{Deserialize, Serialize};
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(tag = "type", rename_all = "camelCase")]
|
||||
pub enum Operation {
|
||||
/// Represents an "add" operation with a given value.
|
||||
/// Represents an `add` operation.
|
||||
///
|
||||
/// `value` is the value to add.
|
||||
Add { value: usize },
|
||||
|
||||
/// Represents a "dereference" operation with optional parameters for the number of times to dereference
|
||||
/// and the size of the resulting value.
|
||||
/// Represents a `dereference` operation.
|
||||
///
|
||||
/// `times` is the number of times to dereference the address. If `None`, the number of times will be `1`.
|
||||
/// `size` is the size of the resulting value. If `None`, the size will be `8`.
|
||||
Dereference {
|
||||
Deref {
|
||||
times: Option<usize>,
|
||||
size: Option<usize>,
|
||||
},
|
||||
|
||||
/// Represents an operation to resolve the absolute address of a relative "jmp" with an optional
|
||||
/// offset and length.
|
||||
/// Represents an operation to resolve the absolute address of a relative call.
|
||||
///
|
||||
/// `offset` is the offset of the displacement value. If `None`, the offset will be `0x1`.
|
||||
/// `length` is the length of the instruction. If `None`, the length will be `0x5`.
|
||||
@@ -29,8 +27,7 @@ pub enum Operation {
|
||||
length: Option<usize>,
|
||||
},
|
||||
|
||||
/// Represents an operation to resolve the absolute address of a RIP-relative address with an optional
|
||||
/// offset and length.
|
||||
/// Represents an operation to resolve the absolute address of a RIP-relative address.
|
||||
///
|
||||
/// `offset` is the offset of the displacement value. If `None`, the offset will be `0x3`.
|
||||
/// `length` is the length of the instruction. If `None`, the length will be `0x7`.
|
||||
@@ -39,19 +36,19 @@ pub enum Operation {
|
||||
length: Option<usize>,
|
||||
},
|
||||
|
||||
/// Represents a "slice" operation with a start and end index.
|
||||
/// Represents a `slice` operation.
|
||||
///
|
||||
/// `start` is the start index of the slice.
|
||||
/// `end` is the end index of the slice.
|
||||
Slice { start: usize, end: usize },
|
||||
|
||||
/// Represents a "subtract" operation with a given value.
|
||||
/// Represents a `subtract` operation.
|
||||
///
|
||||
/// `value` is the value to subtract.
|
||||
Subtract { value: usize },
|
||||
Sub { value: usize },
|
||||
}
|
||||
|
||||
/// Represents a signature for a specific module.
|
||||
/// Represents a signature in the `config.json` file.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Signature {
|
||||
/// The name of the signature.
|
||||
@@ -63,12 +60,13 @@ pub struct Signature {
|
||||
/// The pattern of the signature.
|
||||
pub pattern: String,
|
||||
|
||||
/// The list of operations to perform on the signature.
|
||||
/// The list of operations to perform on the target address.
|
||||
pub operations: Vec<Operation>,
|
||||
}
|
||||
|
||||
/// Configuration struct that holds a vector of `Signature` structs.
|
||||
/// Represents the `config.json` file.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Config {
|
||||
/// The list of signatures defined in the `config.json` file.
|
||||
pub signatures: Vec<Signature>,
|
||||
}
|
||||
|
@@ -109,7 +109,7 @@ pub fn dump_interfaces(
|
||||
info!("Dumping interfaces in <blue>{}</>...", module.name);
|
||||
|
||||
let create_interface_address =
|
||||
process.resolve_rip(create_interface_export, 0x3, 0x7)?;
|
||||
process.resolve_rip(create_interface_export, None, None)?;
|
||||
|
||||
let mut node = process.read_memory::<*mut InterfaceNode>(create_interface_address)?;
|
||||
|
||||
|
@@ -59,7 +59,7 @@ pub fn dump_offsets(
|
||||
for operation in signature.operations {
|
||||
match operation {
|
||||
Add { value } => address += value,
|
||||
Dereference { times, size } => {
|
||||
Deref { times, size } => {
|
||||
let times = times.unwrap_or(1);
|
||||
let size = size.unwrap_or(8);
|
||||
|
||||
@@ -72,14 +72,10 @@ pub fn dump_offsets(
|
||||
}
|
||||
}
|
||||
Jmp { offset, length } => {
|
||||
address = process
|
||||
.resolve_jmp(address, offset.unwrap_or(0x1), length.unwrap_or(0x5))?
|
||||
.into()
|
||||
address = process.resolve_jmp(address, offset, length)?.into();
|
||||
}
|
||||
Rip { offset, length } => {
|
||||
address = process
|
||||
.resolve_rip(address, offset.unwrap_or(0x3), length.unwrap_or(0x7))?
|
||||
.into()
|
||||
address = process.resolve_rip(address, offset, length)?.into()
|
||||
}
|
||||
Slice { start, end } => {
|
||||
let mut result: usize = 0;
|
||||
@@ -92,7 +88,7 @@ pub fn dump_offsets(
|
||||
|
||||
address = result.into();
|
||||
}
|
||||
Subtract { value } => address -= value,
|
||||
Sub { value } => address -= value,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +158,7 @@ mod tests {
|
||||
.expect("Failed to find engine2.dll")
|
||||
.base();
|
||||
|
||||
let build_number = process.read_memory::<u32>(engine_base + 0x48B524)?; // dwBuildNumber
|
||||
let build_number = process.read_memory::<u32>(engine_base + 0x48A514)?; // dwBuildNumber
|
||||
|
||||
println!("Build number: {}", build_number);
|
||||
|
||||
@@ -178,14 +174,14 @@ mod tests {
|
||||
.expect("Failed to find client.dll")
|
||||
.base();
|
||||
|
||||
let force_attack = process.read_memory::<u32>(client_base + 0x16B2300)?; // dwForceAttack
|
||||
let force_attack_2 = process.read_memory::<u32>(client_base + 0x16B2390)?; // dwForceAttack2
|
||||
let force_backward = process.read_memory::<u32>(client_base + 0x16B25D0)?; // dwForceBackward
|
||||
let force_crouch = process.read_memory::<u32>(client_base + 0x16B28A0)?; // dwForceCrouch
|
||||
let force_forward = process.read_memory::<u32>(client_base + 0x16B2540)?; // dwForceForward
|
||||
let force_jump = process.read_memory::<u32>(client_base + 0x16B2810)?; // dwForceJump
|
||||
let force_left = process.read_memory::<u32>(client_base + 0x16B2660)?; // dwForceLeft
|
||||
let force_right = process.read_memory::<u32>(client_base + 0x16B26F0)?; // dwForceRight
|
||||
let force_attack = process.read_memory::<u32>(client_base + 0x16B5410)?; // dwForceAttack
|
||||
let force_attack_2 = process.read_memory::<u32>(client_base + 0x16B54A0)?; // dwForceAttack2
|
||||
let force_backward = process.read_memory::<u32>(client_base + 0x16B56E0)?; // dwForceBackward
|
||||
let force_crouch = process.read_memory::<u32>(client_base + 0x16B59B0)?; // dwForceCrouch
|
||||
let force_forward = process.read_memory::<u32>(client_base + 0x16B5650)?; // dwForceForward
|
||||
let force_jump = process.read_memory::<u32>(client_base + 0x16B5920)?; // dwForceJump
|
||||
let force_left = process.read_memory::<u32>(client_base + 0x16B5770)?; // dwForceLeft
|
||||
let force_right = process.read_memory::<u32>(client_base + 0x16B5800)?; // dwForceRight
|
||||
|
||||
let get_key_state = |value: u32| -> &str {
|
||||
match value {
|
||||
@@ -255,7 +251,7 @@ mod tests {
|
||||
.expect("Failed to find client.dll")
|
||||
.base();
|
||||
|
||||
let global_vars = process.read_memory::<*const GlobalVarsBase>(client_base + 0x16AE488)?; // dwGlobalVars
|
||||
let global_vars = process.read_memory::<*const GlobalVarsBase>(client_base + 0x16B14F0)?; // dwGlobalVars
|
||||
|
||||
let current_map_name = unsafe {
|
||||
(*global_vars)
|
||||
@@ -277,7 +273,7 @@ mod tests {
|
||||
.expect("Failed to find inputsystem.dll")
|
||||
.base();
|
||||
|
||||
let input_system = input_system_base + 0x35770; // dwInputSystem
|
||||
let input_system = input_system_base + 0x35760; // dwInputSystem
|
||||
|
||||
let is_key_down = |key_code: i32| -> bool {
|
||||
let key_map_element = process
|
||||
@@ -304,9 +300,9 @@ mod tests {
|
||||
.expect("Failed to find client.dll")
|
||||
.base();
|
||||
|
||||
let local_player_controller = process.read_memory::<usize>(client_base + 0x17FCDC8)?; // dwLocalPlayerController
|
||||
let local_player_controller = process.read_memory::<usize>(client_base + 0x1800008)?; // dwLocalPlayerController
|
||||
|
||||
let player_name = process.read_string((local_player_controller + 0x628).into())?; // m_iszPlayerName
|
||||
let player_name = process.read_string((local_player_controller + 0x640).into())?; // m_iszPlayerName
|
||||
|
||||
println!("Local player name: {}", player_name);
|
||||
|
||||
@@ -322,7 +318,7 @@ mod tests {
|
||||
.expect("Failed to find client.dll")
|
||||
.base();
|
||||
|
||||
let local_player_pawn = process.read_memory::<usize>(client_base + 0x16B9388)?; // dwLocalPlayerPawn
|
||||
let local_player_pawn = process.read_memory::<usize>(client_base + 0x16BC4B8)?; // dwLocalPlayerPawn
|
||||
|
||||
let game_scene_node = process.read_memory::<usize>((local_player_pawn + 0x310).into())?; // m_pGameSceneNode
|
||||
|
||||
@@ -350,8 +346,8 @@ mod tests {
|
||||
.expect("Failed to find engine2.dll")
|
||||
.base();
|
||||
|
||||
let window_width = process.read_memory::<u32>(engine_base + 0x541E18)?; // dwWindowWidth
|
||||
let window_height = process.read_memory::<u32>(engine_base + 0x541E1C)?; // dwWindowHeight
|
||||
let window_width = process.read_memory::<u32>(engine_base + 0x540CE0)?; // dwWindowWidth
|
||||
let window_height = process.read_memory::<u32>(engine_base + 0x540CE4)?; // dwWindowHeight
|
||||
|
||||
println!("Window size: {}x{}", window_width, window_height);
|
||||
|
||||
|
@@ -26,9 +26,9 @@ impl<'a> SchemaSystem<'a> {
|
||||
let mut address = process.find_pattern(
|
||||
"schemasystem.dll",
|
||||
"48 8D 0D ? ? ? ? E9 ? ? ? ? CC CC CC CC 48 8D 0D ? ? ? ? E9 ? ? ? ? CC CC CC CC 48 83 EC 28"
|
||||
).expect("Failed to find SchemaSystem pattern");
|
||||
).expect("Failed to find pattern for SchemaSystem");
|
||||
|
||||
address = process.resolve_rip(address, 0x3, 0x7)?;
|
||||
address = process.resolve_rip(address, None, None)?;
|
||||
|
||||
Ok(Self { process, address })
|
||||
}
|
||||
|
@@ -229,7 +229,7 @@ impl Process {
|
||||
Ok(String::from_utf8(buffer)?)
|
||||
}
|
||||
|
||||
/// Resolves the absolute address of relative "jmp".
|
||||
/// Resolves the absolute address of a relative call.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
@@ -241,11 +241,18 @@ impl Process {
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<Address>` - A `Result` containing the absolute address if successful, or an error if the memory read fails.
|
||||
pub fn resolve_jmp(&self, address: Address, offset: usize, length: usize) -> Result<Address> {
|
||||
pub fn resolve_jmp(
|
||||
&self,
|
||||
address: Address,
|
||||
offset: Option<usize>,
|
||||
length: Option<usize>,
|
||||
) -> Result<Address> {
|
||||
// The displacement value can be negative.
|
||||
let displacement = self.read_memory::<i32>(address.add(offset))?;
|
||||
let displacement = self.read_memory::<i32>(address.add(offset.unwrap_or(0x1)))?;
|
||||
|
||||
Ok(((address.add(length).0 as isize + displacement as isize) as usize).into())
|
||||
Ok(address
|
||||
.add(length.unwrap_or(0x5))
|
||||
.add(displacement as usize))
|
||||
}
|
||||
|
||||
/// Resolves the absolute address of a RIP-relative address.
|
||||
@@ -254,17 +261,24 @@ impl Process {
|
||||
///
|
||||
/// * `&self` - A reference to the `Process` struct.
|
||||
/// * `address` - The address of the relative instruction pointer (RIP).
|
||||
/// * `offset` - The offset of the displacement value.
|
||||
/// * `length` - The length of the instruction.
|
||||
/// * `offset` - The offset of the displacement value. If `None`, the offset will be `0x3`.
|
||||
/// * `length` - The length of the instruction. If `None`, the length will be `0x7`.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<Address>` - A `Result` containing the absolute address if successful, or an error if the memory read fails.
|
||||
pub fn resolve_rip(&self, address: Address, offset: usize, length: usize) -> Result<Address> {
|
||||
pub fn resolve_rip(
|
||||
&self,
|
||||
address: Address,
|
||||
offset: Option<usize>,
|
||||
length: Option<usize>,
|
||||
) -> Result<Address> {
|
||||
// The displacement value can be negative.
|
||||
let displacement = self.read_memory::<i32>(address.add(offset))?;
|
||||
let displacement = self.read_memory::<i32>(address.add(offset.unwrap_or(0x3)))?;
|
||||
|
||||
Ok(((address.add(length).0 as isize + displacement as isize) as usize).into())
|
||||
Ok(address
|
||||
.add(length.unwrap_or(0x7))
|
||||
.add(displacement as usize))
|
||||
}
|
||||
|
||||
/// Returns the process ID of the first process with the given name.
|
||||
|
Reference in New Issue
Block a user