Last active
February 9, 2018 23:27
-
-
Save abiusx/d4b8365fc98248e1c2e41de482df55ef to your computer and use it in GitHub Desktop.
Honepyt ls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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} "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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