#!/bin/bash # capbash.1.0 # capbash is a special shell for linux that will capture all # commands and the outputs of command typed, then saved to .capbash dir at home directory # created by Henry Saptono , Jul 2010 # How to use: #1. copy capbash to /bin -> cp capbash /bin/ #2. change mode to 755 -> chmod 755 /bin/capbash #3. add capbash to /etc/shells -> echo "/bin/capbash" >> /etc/shells #4. Set or modify type of shell for user to capbash -> usermod -s /bin/capbash henry # VER="1.0" LOGDIR="$HOME/.capbash" if [ ! -d "$LOGDIR" ]; then mkdir -p $LOGDIR fi EXT="`date +%d-%m-%Y_%H\:%M`.cap" FLOG="$LOGDIR/$USER-$EXT" clear echo "`date` : Hello $USER , Now You are using capbash as your shell" SHELL="/bin/capbash" PS1="[$USER@capbash-$VER]\$ " export SHELL PS1 while [ 1 ]; do echo -n "$PS1" read cmd $cmd && echo "`hostname`: `date` : command-> $cmd" >> $FLOG && $cmd >> $FLOG done exit 0