Advertisement
metalx1000

Keystoke Logger with Backspace Warning

Oct 24th, 2012
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.51 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. kb="/dev/input/by-path/platform-i8042-serio-0-event-kbd" #keyboard device
  4. logfile="/tmp/bs.log"
  5.  
  6. #start loggin keystrokes
  7. cat "$kb" | od -i > "$logfile" &
  8.  
  9. while [ 1 ]
  10. do
  11.  
  12.     #Get number of times BackSpace has been pressed
  13.     let x="$(tail -n 600 "$logfile"|awk '{print $5}'|grep "^14$"|wc -l)"
  14.    
  15.     echo "Check keystroke log."
  16.  
  17.     if [ "$x" -gt "20" ]
  18.     then
  19.         echo "BackSpace has been press to many times in the last 100 keystrokes"
  20.         echo "Are you Drunk?"|wall
  21.         sleep 1m
  22.     fi
  23.     sleep 10
  24.  
  25. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement