Hey folks,
I want to cheat in Linux, that is changing the memory of programs at runtime. Kcheat doesn't build anymore, and I didn't find anything comparable, so I thought of throwing together my own little tool.
I learnt that in order to access /proc/PID/mem, I have to attach first with ptrace. But I'm stumped already at the very beginning. I run the following program under sudo:
#!/usr/bin/perl use strict; use diagnostics; use Sys::Ptrace qw(ptrace PTRACE_ATTACH); ptrace PTRACE_ATTACH, 9701; open my $fh, '<', '/proc/9701/mem' or die "could not open mem for read +ing: $!"; my $buf; while (1) { my $res = read $fh, $buf, 8*1024; die "could not read 8KB from mem: $!" unless defined $res; exit if 0 == $res; print $buf; };
This bombs out with "Input/output error at ptrace.pl line 12.". I don't understand why.
In reply to Accessing proc/memory by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |