Occasionally I find myself wishing I had logged the output of some command for later reference and often during those occasions I find myself wishing it had a time stamp. So here is a nice reminder to myself, next time make sure my pentesting machine has these modifications.
- Make sure my prompt includes the time
- Log everything
bash prompt with time stamp (.bashrc)
#example of what we want: #PS1="\n[\t] \u@\h:\w\$ " #embedded in the default ubuntu options "\n[\t] " if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\n[\t] \u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\n[\t] \u@\h:\w\$ ' fi
bash with continuous logging (.bashrc)
make sure we always log our stuff. Note when doing interactive stuff the logs get a little but ugly…but we can live with that
Courtesy of: http://ubuntuforums.org/showthread.php?t=1796500 & https://answers.launchpad.net/ubuntu/+source/gnome-terminal/+question/7131
if [ -z "$UNDER_SCRIPT" ]; then logdir=$HOME/conlogs if [ ! -d $logdir ]; then mkdir $logdir fi #gzip -q $logdir/*.log logfile=$logdir/$(date +%F_%T).$$.log export UNDER_SCRIPT=$logfile script -f -q $logfile exit fi
References
- http://ubuntuforums.org/showthread.php?t=1796500
- https://answers.launchpad.net/ubuntu/+source/gnome-terminal/+question/7131
- http://www.lifeaftercoffee.com/2006/10/31/customize-your-bash-prompt/
- https://makandracards.com/makandra/1090-customize-your-bash-prompt
- http://divby0.blogspot.nl/2008/09/howto-timestamp-your-bash-prompt.html