LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-25-2002, 05:21 PM   #1
Shak
Member
 
Registered: May 2002
Location: Huddersfield
Distribution: Redhat (7.2, 7.3, 8.0), Debian, Slackware, Gentoo, FreeBSD
Posts: 169

Rep: Reputation: 30
Counting Keystrokes in Linux.


Hi,

Im looking for a way to count the number of keys pressed on a Linux system both from X and in X applications and in terminals.

I am planning a project in C/C++ for this, hopefully to be a nice learning project for me

Does anyone have any idea if the keyboard presses can be read anyway?

Thanks
Shak
 
Old 12-25-2002, 11:11 PM   #2
oulevon
Member
 
Registered: Feb 2001
Location: Boston, USA
Distribution: Slackware
Posts: 438

Rep: Reputation: 30
I don't know exactly what you want to do, but the stdin stream is a pointer to a FILE structure, and by default the standard input is usually the keyboard device, so yes keyboard presses can be read. This is in C of course. I don't know anything about C++.
 
Old 12-26-2002, 07:40 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I'm not quite sure how to do something like that, but if I understand correctly, you want to make a program that captures every keystroke entered on your computer, right?

Normally such thing is never needed, unless you want compromise a system. What are you making? Some sort of trojan horse keyboard sniffer?

Anyways, if you want to do that, I guess you'll have to make some sort of kernel-module, since this is about breaking system security anyways....
 
Old 12-26-2002, 09:40 AM   #4
Shak
Member
 
Registered: May 2002
Location: Huddersfield
Distribution: Redhat (7.2, 7.3, 8.0), Debian, Slackware, Gentoo, FreeBSD
Posts: 169

Original Poster
Rep: Reputation: 30
Im not any kind of hacker, I dont want to capture what the keyboard strokes are, just when a button is pressed I want a counter to increase.

Its for a project called Project Dolhin which has a website at http://project-dolphin.net Ill have a look into the possibility of a kernel module (would certianly be a learning experience)

Shak
 
Old 12-28-2002, 10:44 AM   #5
FredrikN
Member
 
Registered: Nov 2001
Location: Sweden
Distribution: GNU/Linux since -97
Posts: 149

Rep: Reputation: 15
Check out Snoop, it's for BSD but download the source and check out the code and then you will se how they did it
 
Old 12-29-2002, 05:27 PM   #6
Shak
Member
 
Registered: May 2002
Location: Huddersfield
Distribution: Redhat (7.2, 7.3, 8.0), Debian, Slackware, Gentoo, FreeBSD
Posts: 169

Original Poster
Rep: Reputation: 30
Thanks sir, Ill definitely do that.

Shak
 
  


Reply



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
How to get keystrokes w/o ncurses dogpatch Programming 6 11-27-2005 10:03 PM
100 Linux tips and counting mchirico LinuxQuestions.org Member Success Stories 1 05-05-2005 03:53 AM
Counting Device Drivers In A Distribution Of Linux tacoshell Linux - General 2 05-03-2005 01:27 PM
Trapping keystrokes in C k4zau Programming 3 03-09-2003 01:13 PM
Second Terminal Keystrokes Guinney Linux - Newbie 2 11-29-2002 08:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:02 AM.

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
Open Source Consulting | Domain Registration