https://github.com/bigbuildbench/tommoa_rs-process-memory
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.0%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: BigBuildBench
- License: mit
- Language: Rust
- Default Branch: master
- Size: 65.4 KB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
process-memory
This crate is loosely based on read-process-memory by luser, but has been extended to be able to write to process memory as well.
The current supported platforms are: - Windows - OSX - Linux
Some examples of use cases for this tool are: - Remote debugging tools - Game "trainers" - Rust clones of Cheat Engine
Examples
```rust // We need the following from process-memory
use process_memory::{Memory, DataMember, Pid, TryIntoProcessHandle};
// We have a variable with some value let x = 4_u32;
// We need to make sure that we get a handle to a process // that we want to read from, in this case, ourselves let handle = ( std::process::id() as Pid ).tryintoprocess_handle().unwrap();
// We make a DataMember that has an offset referring to the location
// of our variable x in memory
let member = DataMember::new_offset(handle, vec![&x as *const _ as usize]);
// Variable member and x now refer to the same memory asserteq!(&x as *const _ as usize, member.getoffset().unwrap());
// The value of member is the same as x assert_eq!(x, unsafe { member.read().unwrap() });
// We can write to and modify the value of x using member member.write(&6u32).unwrap(); asserteq!(x, 6_u32); ```
```rust
use process_memory::{Memory, LocalMember};
// We have a variable with some value let x = 4_u32;
// We make a LocalMember that has an offset referring to its location in memory
let member = LocalMember::new_offset(vec![&x as *const _ as usize]);
// The memory refered to is now the same asserteq!(&x as *const _ as usize, member.getoffset().unwrap());
// The value of the member is the same as the variable assert_eq!(x, unsafe { member.read().unwrap() });
// We can write to and modify the value of the variable using the member member.write(&6u32).unwrap(); asserteq!(x, 6_u32); ```
```no_run
use process_memory::{Architecture, Memory, DataMember, Pid, ProcessHandleExt, TryIntoProcessHandle};
fn getpid(processname: &str) -> Pid {
std::process::id() as Pid
}
// We get a handle for a target process with a different architecture to ourselves let handle = getpid("32Bit.exe").tryintoprocesshandle().unwrap() .set_arch(Architecture::Arch32Bit);
// We make a DataMember that has a series of offsets refering to a known value in
// the target processes memory
let member = DataMember::newoffset(handle, vec![0x01020304, 0x04, 0x08, 0x10]);
// The memory offset can now be correctly calculated: let targetMemoryLocation = member.get_offset().unwrap();
// The memory offset can now be used to retrieve and modify values: let currentValue = unsafe { member.read().unwrap() };
member.write(&123_u32).unwrap(); ```
Owner
- Name: BigBuildBench
- Login: BigBuildBench
- Kind: organization
- Repositories: 1
- Profile: https://github.com/BigBuildBench
abbr. B3, benchmarking the repo-level understanding capability of your LLMs by reconstructing project build-file.
GitHub Events
Total
- Create event: 6
Last Year
- Create event: 6
Dependencies
- actions-rs/cargo v1 composite
- actions-rs/toolchain v1 composite
- actions/checkout v1 composite