LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-21-2010, 02:14 PM   #1
Royzz
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Rep: Reputation: 0
showkey to develop keylogger


I wish to use the showkey function to develeop a keylogger. The problem is: the function terminates if no key is pressed for 10 consecutive seconds. I tried using the -t option as suggested in some forums, but my version of showkey doesn't have the option of changing the timeout.

The options I get are:
-h --help display this help text
-a --ascii display the decimal/octal/hex values of the keys
-s --scancodes display only the raw scan-codes
-k --keycodes display only the interpreted keycodes (default).

Is it possible to write a script to use this function and still keep the function active until an interrupt is recieved?

Thanks in advance !
 
Old 02-22-2010, 07:47 AM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
The source code for showkey can be found here:
http://www.kernel.org/pub/linux/util...d-1.15.tar.bz2

I looked at the code and observed, that the 10 seconds timeout is hardcoded. Maybe you can modify the source code to overcome this limit?

Otherwise you can call showkey in an endless loop.
 
Old 02-23-2010, 02:10 AM   #3
Royzz
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by irmin View Post
The source code for showkey can be found here:
http://www.kernel.org/pub/linux/util...d-1.15.tar.bz2

I looked at the code and observed, that the 10 seconds timeout is hardcoded. Maybe you can modify the source code to overcome this limit?

Otherwise you can call showkey in an endless loop.
If I run it in an endless loop, then multiple calls will be made if previous functions do not time out. Won't that create multiple logs and redundant data?
 
Old 02-23-2010, 02:51 AM   #4
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Quote:
Originally Posted by Royzz View Post
If I run it in an endless loop, then multiple calls will be made if previous functions do not time out. Won't that create multiple logs and redundant data?
You do not start infinitely many showkey processes at the same time, but just restart showkey, if it terminates.
 
Old 02-24-2010, 11:41 AM   #5
Royzz
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by irmin View Post
You do not start infinitely many showkey processes at the same time, but just restart showkey, if it terminates.
How do I code the code for understanding that showkey has terminated and it needs to be restarted?
 
Old 02-24-2010, 12:14 PM   #6
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Quote:
Originally Posted by Royzz View Post
How do I code the code for understanding that showkey has terminated and it needs to be restarted?
In bash/sh you will do
Code:
while true; do showkey -k >> mylog; done
 
Old 02-25-2010, 12:19 AM   #7
Royzz
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by irmin View Post
In bash/sh you will do
Code:
while true; do showkey -k >> mylog; done
Hi! I tried the code in the shell, it is working fine....but when I switch to another app(Word Processor etc), or switch to another terminal....it doesn't work.

Pretty stupid problem now.....it works normally if I remove >>mylog, the function showkey terminates and restarts on its own.

What does the >>mylog mean? Does the showkey function write the captured keypresses, maps it to some data structure present in mylog, and write out the equivalent alphanumeric characters on to the console?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
keylogger? |2ainman Linux - Security 4 08-21-2013 04:48 AM
about keylogger abrenar Linux - Security 3 02-24-2009 04:26 AM
Possible keylogger? StefaX Linux - Security 3 01-27-2009 06:23 PM
Linux Keylogger theunixwizard Linux - Security 3 02-19-2008 08:00 AM
help with lkl keylogger br0k3n Linux - Software 0 07-22-2004 05:55 PM


All times are GMT -5. The time now is 01:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration