How often have you been hacking at a box and wish you had recorded of all the commands you ran for your personal review of to include in a pentest report? There's a Linux tool that does this very thing. It's simply the script command.
Using script
script is installed by default on most Linux systems. To record a session, type script [filename] to save your interactive shell session to the named file.
Once initiated, as mentioned by the start statement, your session will be recorded in memory. Now you can run commands as you normally would.
When finished, type exit and the file will be written with all your commands and output conveniently recorded, just as you typed them. Now, just use cat or less -r to view your file.
script Options
As with most commands that I use, I end up utilizing just a subset of the available options. The script
command has several parameters that I've seldom found useful in my day-to-day work. The ones I commonly use are:
-a
for appending new commands and output to a previously-used file-q
for removing the initial starting and ending statements when usingscript
--t
for saving timing information for playback
May all your pentests be effective and fun!