473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Keyboard Buffer

I am a relative c newbie, so bare with me.

I need to write a program that writes all keyboard keystrokes into a
text file (up to 500KB at which point it would begin overwriting itself)
regardless of what application the user is inputing data into (email,
office documents, etc). The purpose of this program is to have a real
time backup of user input so that user input can be restored when a PC
crashes or unexpectedly looses power. The idea came about when one of my
bosses lost an email that she had been typing all day due to a power
failure. She became angry when I told her that I could not recover her
data as it was created and destroyed *in between* scheduled backups so I
could not restore it from a backup tape. She then told me to devise a
solution for this type of situation.

Anyway, I started writing this program in Python, but soon found that
Python isn't really suited to this sort of thing. I have written some c
before and members of comp.lan.python reccomneded that this be written
in c, so I thought I'd post here and ask for direction.

How would I start writing such a program in c? What resources would you
guys reccomend? The platform the program will run on is x86, Win32
(mostly win2000/XP).

Thanks for any advice!!!

Nov 13 '05 #1
7 8772

"hokiegal99" <ho********@hotmail.com> wrote in message
news:3F************@hotmail.com...
I am a relative c newbie, so bare with me.

I need to write a program that writes all keyboard keystrokes into a
text file (up to 500KB at which point it would begin overwriting itself)
regardless of what application the user is inputing data into (email,
office documents, etc). The purpose of this program is to have a real
time backup of user input so that user input can be restored when a PC
crashes or unexpectedly looses power. The idea came about when one of my
bosses lost an email that she had been typing all day due to a power
failure. She became angry when I told her that I could not recover her
data as it was created and destroyed *in between* scheduled backups so I
could not restore it from a backup tape. She then told me to devise a
solution for this type of situation.

Anyway, I started writing this program in Python, but soon found that
Python isn't really suited to this sort of thing. I have written some c
before and members of comp.lan.python reccomneded that this be written
in c, so I thought I'd post here and ask for direction.

How would I start writing such a program in c? What resources would you
guys reccomend? The platform the program will run on is x86, Win32
(mostly win2000/XP).

Thanks for any advice!!!


You are talking about a keylogger of course. There are many keyloggers
available some are freeware. (google search)

If you want to write your own then you will need to use platform specific
extensions.
Since you are using windows then I can advise you to use the windows API.

Go here for page1 of an interesting example:
http://www.infosecwriters.com/hhworld/hh2.php

HTH
cw
Nov 13 '05 #2
hokiegal99 wrote:
I need to write a program that writes all keyboard keystrokes into a
text file (up to 500KB at which point it would begin overwriting itself)
regardless of what application the user is inputing data into (email,
office documents, etc). The purpose of this program is to have a real
time backup of user input so that user input can be restored when a PC
crashes or unexpectedly looses power. The idea came about when one of my
bosses lost an email that she had been typing all day due to a power
failure. She became angry when I told her that I could not recover her
data as it was created and destroyed *in between* scheduled backups so I
could not restore it from a backup tape. She then told me to devise a
solution for this type of situation.


Do please be aware that such a program presents serious security
issues. Any passwords your boss types will be in the file in
clear.

Your boss should learn to save her work periodically. Finding a
tactful way to tell her this is left as an exercise for the
student ;)

http://www.jokeloft.com/jokes/743.html

--
Tom Zych
This email address will expire at some point to thwart spammers.
Permanent address: echo 'g******@cbobk.pbz' | rot13
Nov 13 '05 #3

hokiegal99 <ho********@hotmail.com> wrote in message
news:3F************@hotmail.com...
I am a relative c newbie, so bare with me.

I need to write a program that writes all keyboard keystrokes into a
text file (up to 500KB at which point it would begin overwriting itself)
regardless of what application the user is inputing data into (email,
office documents, etc). The purpose of this program is to have a real
time backup of user input so that user input can be restored when a PC
crashes or unexpectedly looses power. The idea came about when one of my
bosses lost an email that she had been typing all day due to a power
failure. She became angry when I told her that I could not recover her
data as it was created and destroyed *in between* scheduled backups so I
could not restore it from a backup tape. She then told me to devise a
solution for this type of situation.
A solution already exists. Periodic saving of the data file
(some word processors have a feature to do this automatically).
But it doesn't really take much to train oneself to hit a 'save'
button every paragraph, or every ten minutes, or whatever.
Perhaps I'm paranoid by nature, but I've always done this
instinctively.

Anyway, I started writing this program in Python, but soon found that
Python isn't really suited to this sort of thing. I have written some c
before and members of comp.lan.python reccomneded that this be written
in c, so I thought I'd post here and ask for direction.

How would I start writing such a program in c? What resources would you
guys reccomend? The platform the program will run on is x86, Win32
(mostly win2000/XP).

Thanks for any advice!!!


I advise you not to create or use such an application, as
it creates a large security risk.

This is not possible to write in standard C anyway. Only
actual characters sent to stdin could be recorded, but not
things like function keys, etc.

-Mike

Nov 13 '05 #4
hokiegal99 <ho********@hotmail.com> wrote:

<SNIP>
[...] The purpose of this program is to have a real
time backup of user input so that user input can be restored when a PC
crashes or unexpectedly looses power.


Carefully feed this program to the computer located between
your boss' ears (of course in a polite manner):

1. Save early
2. Save often
3. Make backups
4. Make more backups
5. Make even more backups

Anyone neglecting these traditional basic rules of safe and
productive computer usage gets what (s)he deserves.

Irrwahn
--
Close your eyes and press escape three times.
Nov 13 '05 #5
"hokiegal99" <ho********@hotmail.com> wrote in message
news:3F************@hotmail.com...
I am a relative c newbie, so bare with me.

The idea came about when one of my
bosses lost an email that she had been typing all day due to a power
failure. She became angry when I told her that I could not recover her
data as it was created and destroyed *in between* scheduled backups so I
could not restore it from a backup tape. She then told me to devise a
solution for this type of situation.

Relax. All newbies feel this way, and your boss is no exception. Everyone
has to lose work to understand backups. She didn't lose the letter because
you didn't back it up, as it was not yet on the harddisk, only in memory.
Explain that when one has done a certain amount of work (1/2 hour, 1 hour,
10 minutes) on needs to save to disk in order for a backup to be made, and
no power failure will matter. You don't need a keystroke monitor, you need
an automatic backup save like MS Word does.
She has learned a life-long important lesson, and as all lessons are
learned, she learned the hard way.

You should also look for a job where you don't have to work for a bitch who
passes off her mistakes as yours.

I will give you advice that I learned the hard way - If you can't restore
those backups, you don't have a backup. Make sure you have a second system,
and once a week or so actually restore one of those hundreds of tape you are
keeping. Try getting back something from 4 months ago, as a test.

--
ArWeGod
Nov 13 '05 #6
"hokiegal99" <ho********@hotmail.com> wrote in message

How would I start writing such a program in c? What resources would > you guys reccomend? The platform the program will run on is x86, Win32 (mostly win2000/XP).

To write a keyboard interceptor in C you will have to read through the
keyboard documentation very carefully on your C compiler. There will
probably be some way to insert a layer between the keyboard and the
application, but this is not a normal thing to do so it won't be easy.

Then you have the problem of actually restoring the data. To do this nicely
you will have to store the application the keystroke was intended for,
restore the application to the state it was in when it accepted they
keystroke, and simulate the keys. Not an easy thing to do.

You could simply store a log of keystrokes and then cut and paste the bigger
areas of text. However this has the problem that most text editors allow
random editing, so the log of keystrokes won't read like the text that was
being written.

I would like to know how commercial products solve such problems. Since
backing up is a basic problem, not something specific to your organisation,
an in-house program doesn't seem called for.
Nov 13 '05 #7
Malcolm <ma*****@55bank.freeserve.co.uk> wrote:
"hokiegal99" <ho********@hotmail.com> wrote in message

How would I start writing such a program in c? What resources would > you guys reccomend? The platform the program will run on is x86,
Win32 (mostly win2000/XP).

To write a keyboard interceptor in C you will have to read through the
keyboard documentation very carefully on your C compiler. There will
probably be some way to insert a layer between the keyboard and the
application, but this is not a normal thing to do so it won't be easy.

Then you have the problem of actually restoring the data. To do this nicely
you will have to store the application the keystroke was intended for,
restore the application to the state it was in when it accepted they
keystroke, and simulate the keys. Not an easy thing to do. You could simply store a log of keystrokes and then cut and paste the bigger
areas of text. However this has the problem that most text editors allow
random editing, so the log of keystrokes won't read like the text that was
being written. I would like to know how commercial products solve such problems. Since


Probably by auto-saving the file at regular intervals :-).

Alex
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: herrcho | last post by:
What's the difference between STDIN and Keyboard buffer ? when i get char through scanf, i type in some characters and press enter, then, where do the characters go ? to STDIN or Keyboard...
4
by: santa19992000 | last post by:
can I use scanf to get input (some times user enters input sometimes not, just hit keyboard)?. It displays to enter IP address, if user wants to change, then he enters, otherwise he hits keyboard,...
1
by: Larry | last post by:
Hi my friends. How can I read keyboard buffer by C++ ? Best regards, Larry
5
by: nx-2000 | last post by:
I've got a very large C# forms app and now that its being used in bigger environments we're getting a steady stream of "why does it do this?" problems. The most nagging of which right now is that...
0
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
2
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
1
by: Damir | last post by:
Hallo everybody Does anyone knows how to access Keyboard buffer? At the moment I'm catching KeyDown event of the form, and waiting for carrige return or return key, but sometimes the Keyboard...
3
by: muthursyamburi | last post by:
Hello All, I'm really looking for a help in reading/writing the keyboard buffer in AIX (IBM Unix). In DOS, there is some memory addres (I remember it as 0x417) from where the keyboard buffer...
11
by: vbguy2008 | last post by:
Hi, I am coding a Windows Form Application in VB.NET 2008. I would like to clear the keyboard buffer or at least empty all outstanding key presses queued up for my application at certain points...
3
by: NaN | last post by:
I've been trying to use _kbhit() but it didn't do what I thought it would from books, "Detects whether a keypress is available for reading." Herbert Schildt says, "If the user has pressed a key,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.