mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-04-24 19:25:34 +08:00
Use data from .so
file instead of the one loaded into the process
This commit is contained in:
parent
ede86928d8
commit
1ef287c535
@ -16,7 +16,6 @@ pub struct ModuleEntry {
|
||||
pub path: PathBuf,
|
||||
pub start_addr: usize,
|
||||
pub data: Vec<u8>,
|
||||
pub module_file_data: Vec<u8>,
|
||||
}
|
||||
/// Represents a module loaded in a Windows process.
|
||||
pub struct Module<'a> {
|
||||
@ -54,7 +53,7 @@ impl<'a> Module<'a> {
|
||||
// parse the elf
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn parse(name: &'a str, module_entry: &'a ModuleEntry) -> Result<Self> {
|
||||
let elf = Elf::parse(&module_entry.module_file_data)?;
|
||||
let elf = Elf::parse(&module_entry.data)?;
|
||||
Ok(Self {
|
||||
name,
|
||||
module_info: module_entry,
|
||||
|
@ -355,19 +355,14 @@ impl Process {
|
||||
|
||||
for (module_name, (address_space, path)) in modules_info.into_iter() {
|
||||
let (start, end) = address_space;
|
||||
let mut data = vec![0; (end - start + 1) as usize];
|
||||
if let Ok(_) = self.read_memory_raw(
|
||||
(start as usize).into(),
|
||||
data.as_mut_ptr() as *mut _,
|
||||
data.len(),
|
||||
) {
|
||||
// let mut data = vec![0; (end - start + 1) as usize];
|
||||
if let Ok(data) = Process::read_elf_file(&path) {
|
||||
self.modules.insert(
|
||||
module_name,
|
||||
ModuleEntry {
|
||||
path: path.clone(),
|
||||
start_addr: start as usize,
|
||||
data: data,
|
||||
module_file_data: Process::read_elf_file(&path)?,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user