473,545 Members | 524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8778

"hokiegal99 " <ho********@hot mail.com> wrote in message
news:3F******** ****@hotmail.co m...
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********@hot mail.com> wrote in message
news:3F******** ****@hotmail.co m...
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********@hot mail.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********@hot mail.com> wrote in message
news:3F******** ****@hotmail.co m...
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********@hot mail.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.u k> wrote:
"hokiegal99 " <ho********@hot mail.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
7684
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 buffer ? are they same ? thanks ^^
4
3863
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, which should prompt next one, how can I do in C program?. Thanks. enter IP address:
1
7188
by: Larry | last post by:
Hi my friends. How can I read keyboard buffer by C++ ? Best regards, Larry
5
21039
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 when a MessageBox.Show() is displayed, if the user hits enter or esc, those keys get passed back to the form. From searching online, this is...
0
6634
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 my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles....
2
8743
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 my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles....
1
4594
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 scanner doesn't send those keys, so I would like to wait so long until keyboard buffer is empty. Any helb will be appriciated
3
5218
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 starts. But I need the same in AIX. My requirement is this. In AIX, we need to change the password every 60 days or so. And while changing, it wont...
11
13158
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 in my program. I looked at System.Console.Read, but that doesn't seems appropriate. I also looked into EnableWindow Lib "user32". I ran into a...
3
2991
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, this function returns true(non-0), but does not read the character. If no keystroke is pending, kbhit() returns false (0)." Here is the test...
0
7455
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7390
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7802
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7743
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5959
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5319
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4940
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
692
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.