Install gcore
(part of gdb
).
$ sudo apt-get gdb
$ make
Run the program with the following command.
$ ./guess
The exepcted output is
Please guess (8 byte):
Then please leave this terminal 1 as it is, and open another terminal. The reason for this is to ensure the program is running and all its content is in the memory now.
Get pid
$ ps -d | grep guess
Example output: 20873 pts/0 00:00:00 guess
Dump the memory (with root privileges using sudo
)
$ sudo gcore pid
Open the dump file
$ vi core.pid
Try to search "PASSWORD" in the file by typing
$ /PASSWORD
Searched and found “PASSWORD” string in the core.pid
file