scanmem alternative with concurrent memory scanning
1# Memmut 2> scanmem alternative with concurrent memory scanning 3 4A little CLI utility that helps you find memory addresses, and write values into that address. 5 6## How to use 7 8First start the program whose address you wanna muck about with, an example program exists in the source which can be started like this: 9 10``` 11$ cargo run --example=simple 12Memory Scanner Target - Press ENTER for new values, Ctrl+C to quit 13Current values: 14Index 0: 5 15Index 1: 7 16Index 2: 6 17Index 3: 4 18Index 4: 1 19Index 5: 9 20Index 6: 2 21Index 7: 3 22Index 8: 7 23Index 9: 9 24 25Press ENTER to generate new values... 26``` 27 28Everytime you hit enter, the values will change. Each belonging to a memory address. 29 30Then to run the actual scanner: 31 32``` 33$ cargo build && sudo ./target/release/memmut "target/debug/examples/simple" 34 Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s 35[sudo] password for user: 36# Scanning for process "target/debug/examples/simple" like how pgrep -f works 37Process found with PID: 833569 38Successfully attached to process. Found 34 readable memory regions. 39Please enter current value, or "help" for other commands. 40> 41``` 42 43This is run with `sudo` because reading/writing to arbitrary memory addresses obviously require `root` privileges. The passed argument to the program is the target name of the process we want to attach to. Once found, it'll drop you into a REPL. 44 45Basic idea is that you write what the number currently is, and everytime it changes to something new, which eventually narrows down the list of addresses to (ideally) 1. Once you know the specific address, you can use `set $index $new-value` to write whatever value you want to that address. 46 47``` 48Successfully attached to process. Found 34 readable memory regions. 49Please enter current value, or "help" for other commands. 50> 8 5101/034 searching 59ac4bb56000 - 59ac4bb79000... 5202/034 searching 59ac4bb79000 - 59ac4bc0a000... 5303/034 searching 59ac4bc0a000 - 59ac4bc10000... 5426/034 searching 77c95d401000 - 77c95d403000... 5522/034 searching 77c95d3f9000 - 77c95d3fa000... 5609/034 searching 77c95d187000 - 77c95d1ab000... 5704/034 searching 59ac4bc10000 - 59ac4bc11000... 5830/034 searching 77c95d42f000 - 77c95d43a000... 59........ok 6029/034 searching 77c95d406000 - 77c95d42f000... 6120/034 searching 77c95d3f6000 - 77c95d3f8000... 62........ok 6312/034 searching 77c95d36b000 - 77c95d36f000... 64........ok 6521/034 searching 77c95d3f8000 - 77c95d3f9000... 66........ok 67........ok 6806/034 searching 77c958000000 - 77c958021000... 6913/034 searching 77c95d36f000 - 77c95d371000... 7015/034 searching 77c95d379000 - 77c95d37d000... 71........ok 72........ok 7316/034 searching 77c95d37d000 - 77c95d3a1000... 74........ok 7517/034 searching 77c95d3a1000 - 77c95d3a5000... 7610/034 searching 77c95d1ab000 - 77c95d31c000... 77........ok 7827/034 searching 77c95d403000 - 77c95d405000... 7907/034 searching 77c95cf84000 - 77c95d184000... 80........ok 8108/034 searching 77c95d184000 - 77c95d187000... 8218/034 searching 77c95d3a5000 - 77c95d3a6000... 83........ok 8419/034 searching 77c95d3a6000 - 77c95d3a7000... 8524/034 searching 77c95d3fd000 - 77c95d3ff000... 8625/034 searching 77c95d3ff000 - 77c95d401000... 87........ok 88........ok 89........ok 9031/034 searching 77c95d43a000 - 77c95d43c000... 9132/034 searching 77c95d43c000 - 77c95d43d000... 92........ok 9328/034 searching 77c95d405000 - 77c95d406000... 9433/034 searching 77c95d43d000 - 77c95d43e000... 9534/034 searching 7fff41040000 - 7fff41062000... 9611/034 searching 77c95d31c000 - 77c95d36b000... 97........ok 9805/034 searching 59ac69d8f000 - 59ac69db0000... 9923/034 searching 77c95d3fb000 - 77c95d3fd000... 100........ok 101........ok 102........ok 10314/034 searching 77c95d371000 - 77c95d379000... 104........ok 105........ok 106........ok 107........ok 108........ok 109........ok 110........ok 111........ok 112........ok 113........ok 114........ok 115........ok 116........ok 117........ok 118........ok 1192393> 1 120..........ok 12113> 1 122..........ok 1232> 9 124..........ok 1252> 5 126..........ok 1271> set 0 1000 128``` 129 130Once the `set` command is run, the other process should now have been reading the new value.