Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shell script to capture keyboard activities

Tags:

linux

shell

unix

How to capture all keyboard strokes using shell script .Is there any command that is related to keyboard activities.

like image 596
Rajeev Avatar asked Nov 05 '22 09:11

Rajeev


2 Answers

If you would like to log all input and output, you can use the script command.

$ script transcript.txt
Script started, file is transcript.txt
$ echo 'Hello, world!'
Hello, world!
$ exit
Script done, file is transcript.txt
$ cat transcript.txt 
Script started on Thu 09 Sep 2010 03:06:56 PM EDT
$ echo 'Hello, world!'
Hello, world!
$ exit

Script done on Thu 09 Sep 2010 03:07:06 PM EDT
like image 146
Brian Campbell Avatar answered Nov 09 '22 17:11

Brian Campbell


Check out the trap command.

For example, type in your console :

trap "echo \"Arrrrggghhhh\"" INT

Now press Ctrl + C - fun fun :)

like image 31
lucas1000001 Avatar answered Nov 09 '22 16:11

lucas1000001