Skip to content

Instantly share code, notes, and snippets.

@abiusx
Last active February 9, 2018 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abiusx/d4b8365fc98248e1c2e41de482df55ef to your computer and use it in GitHub Desktop.
Save abiusx/d4b8365fc98248e1c2e41de482df55ef to your computer and use it in GitHub Desktop.
Honepyt ls
#!/bin/bash
LOGFILE="/tmp/lslog"
ORIGINAL_LS="/bin/LS"
#chmod 777 "${LOGFILE}"
WHOAMI=$(whoami)
TTY=$(tty)
CWD="$(pwd)"
PARENT_COMMAND="$(ps -o comm= $PPID)"
ID="$(id)"
DATE=`date '+%Y-%m-%d %H:%M:%S'`
echo -e "[$DATE]\n$PARENT_COMMAND ($PPID)\n$WHOAMI@$CWD\nTTY\t=\t${TTY}\nARGS\t=\t$@\nID\t=\t${ID}\n--------------------------------\n " >>"${LOGFILE}"
${ORIGINAL_LS} "$@"
@abiusx
Copy link
Author

abiusx commented Feb 9, 2018

sudo mv /bin/ls /bin/LS
sudo nano /bin/ls # add the code above to it
sudo touch /tmp/lslog
sudo chmod 777 /tmp/lslog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment