{"id":13671644,"url":"https://github.com/Tommoa/rs-process-memory","last_synced_at":"2025-04-27T18:31:29.544Z","repository":{"id":37979771,"uuid":"117083924","full_name":"Tommoa/rs-process-memory","owner":"Tommoa","description":"A rust library that allows you to read/write into the memory of other processes","archived":false,"fork":false,"pushed_at":"2023-09-02T01:44:55.000Z","size":60,"stargazers_count":142,"open_issues_count":5,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T23:15:48.483Z","etag":null,"topics":["memory","memory-management","rust","rust-library"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tommoa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-11T10:13:22.000Z","updated_at":"2025-02-25T13:44:20.000Z","dependencies_parsed_at":"2024-11-11T09:31:47.102Z","dependency_job_id":"5d8cf876-b8b6-4cd8-9fe7-87ea9b215e5f","html_url":"https://github.com/Tommoa/rs-process-memory","commit_stats":{"total_commits":47,"total_committers":4,"mean_commits":11.75,"dds":"0.12765957446808507","last_synced_commit":"2063f7836e7d409861e552359e79487c73d839f4"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tommoa%2Frs-process-memory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tommoa%2Frs-process-memory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tommoa%2Frs-process-memory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tommoa%2Frs-process-memory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tommoa","download_url":"https://codeload.github.com/Tommoa/rs-process-memory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251187210,"owners_count":21549603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["memory","memory-management","rust","rust-library"],"created_at":"2024-08-02T09:01:15.306Z","updated_at":"2025-04-27T18:31:29.206Z","avatar_url":"https://github.com/Tommoa.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# process-memory\n[![](https://img.shields.io/crates/v/process-memory.svg)](https://crates.io/crates/process-memory)\n[![](https://docs.rs/process-memory/badge.svg)](https://docs.rs/process-memory)\n![Continuous Integration](https://github.com/Tommoa/rs-process-memory/workflows/Continuous%20integration/badge.svg)\n\nThis crate is loosely based on [`read-process-memory`](https://github.com/luser/read-process-memory) by luser, but has been extended to be able to write to process memory as well.\n\nThe current supported platforms are:\n - Windows\n - OSX\n - Linux\n\nSome examples of use cases for this tool are:\n - Remote debugging tools\n - Game \"trainers\"\n - Rust clones of Cheat Engine\n\n## Examples\n```rust\n// We need the following from process-memory\n# use process_memory::{Memory, DataMember, Pid, TryIntoProcessHandle};\n\n// We have a variable with some value\nlet x = 4_u32;\n\n\n// We need to make sure that we get a handle to a process\n// that we want to read from, in this case, ourselves\nlet handle = ( std::process::id() as Pid ).try_into_process_handle().unwrap();\n\n// We make a `DataMember` that has an offset referring to the location\n// of our variable x in memory\nlet member = DataMember::new_offset(handle, vec![\u0026x as *const _ as usize]);\n\n// Variable member and x now refer to the same memory\nassert_eq!(\u0026x as *const _ as usize, member.get_offset().unwrap());\n\n// The value of member is the same as x\nassert_eq!(x, unsafe { member.read().unwrap() });\n\n// We can write to and modify the value of x using member\nmember.write(\u00266_u32).unwrap();\nassert_eq!(x, 6_u32);\n```\n\n\n```rust\n# use process_memory::{Memory, LocalMember};\n\n// We have a variable with some value\nlet x = 4_u32;\n\n// We make a `LocalMember` that has an offset referring to its location in memory\nlet member = LocalMember::new_offset(vec![\u0026x as *const _ as usize]);\n\n// The memory refered to is now the same\nassert_eq!(\u0026x as *const _ as usize, member.get_offset().unwrap());\n\n// The value of the member is the same as the variable\nassert_eq!(x, unsafe { member.read().unwrap() });\n\n// We can write to and modify the value of the variable using the member\nmember.write(\u00266_u32).unwrap();\nassert_eq!(x, 6_u32);\n```\n\n```no_run\n# use process_memory::{Architecture, Memory, DataMember, Pid, ProcessHandleExt, TryIntoProcessHandle};\n# fn get_pid(process_name: \u0026str) -\u003e Pid {\n#     std::process::id() as Pid\n# }\n\n// We get a handle for a target process with a different architecture to ourselves\nlet handle = get_pid(\"32Bit.exe\").try_into_process_handle().unwrap()\n    .set_arch(Architecture::Arch32Bit);\n\n// We make a `DataMember` that has a series of offsets refering to a known value in\n// the target processes memory\nlet member = DataMember::new_offset(handle, vec![0x01_02_03_04, 0x04, 0x08, 0x10]);\n\n// The memory offset can now be correctly calculated:\nlet targetMemoryLocation = member.get_offset().unwrap();\n\n// The memory offset can now be used to retrieve and modify values:\nlet currentValue = unsafe { member.read().unwrap() };\n\nmember.write(\u0026123_u32).unwrap();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTommoa%2Frs-process-memory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTommoa%2Frs-process-memory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTommoa%2Frs-process-memory/lists"}