Skip to content

Instantly share code, notes, and snippets.

@p0c
Last active May 12, 2017 00:29
Show Gist options
  • Save p0c/8315843 to your computer and use it in GitHub Desktop.
Save p0c/8315843 to your computer and use it in GitHub Desktop.
.bashrc auto logging with script // I use it during pentests to automatically log console activity - useful if you forgot to grab some evidences and also for keeping track of your actions / timeline reconstruction
# auto logging - source: https://answers.launchpad.net/ubuntu/+source/gnome-terminal/+question/7131
if [ -z "$UNDER_SCRIPT" ]; then
logdir=$HOME/Log
if [ ! -d $logdir ]; then
mkdir $logdir
fi
logfile=$logdir/$(date +%F_%T).$$.log
export UNDER_SCRIPT=$logfile
script -f -q $logfile
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment