Keyboard Buffer

H

hokiegal99

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!!!
 
C

code_wrong

hokiegal99 said:
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
 
T

Tom Zych

hokiegal99 said:
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
 
M

Mike Wahler

hokiegal99 said:
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
 
I

Irrwahn Grausewitz

[...] 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
 
A

ArWeGod

hokiegal99 said:
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.
 
M

Malcolm

hokiegal99 said:
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.
 
A

Alex

Malcolm said:
guys reccomend? The platform the program will run on is x86,
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top