Keystorkes & AutoTyping

Pages: 12
1) How can you record keystrokes with c++ or win32 ?
2) How do you make a program send typing commands or auto type something into other windows?
closed account (N7LhAqkS)
good question . :)
And Repxl, what was the point of that? I'm no mod but stay on topic.
Anyway I believe there is some information on individual keystroke management in the articles. There is also something in the stickied Console Closing Down thread in the beginners forum. Duoas posted a function using Windows or Linux C++ API to record individual keystrokes
As for your second question I am not sure... is it even possible?
You can use PostMessage() if the application you want to communicate with gives you an internal handle so that you can communicate through the registry.

If the app is one that has no relation to your program, you will have to get a handle to that application's window either with the window name or the class name of the window. Those are two basic options.

I would recommend that you look up PostMessage() in MSDN and follow all the other links that it gives you.
So in other words you bumped the thread... after all your disaster threads in the beginners forum you keep it up don't you? Well I'm not going to expand this into a flamewar; you were offtopic again. At least donate something to the conversation; your posts should have the objective of either helping the original poster or adding a related question/comment of your own. Bumping a thread is actually bad etiquette if it has gone inactive. With pride I quote helios:
............................................________
....................................,.-‘”...................``~.,
.............................,.-”...................................“-.,
.........................,/...............................................”:,
.....................,?......................................................\,
.................../...........................................................,}
................./......................................................,:`^`..}
.............../...................................................,:”........./
..............?.....__.........................................:`.........../
............./__.(.....“~-,_..............................,:`........../
.........../(_....”~,_........“~,_....................,:`........_/
..........{.._$;_......”=,_.......“-,_.......,.-~-,},.~”;/....}
...........((.....*~_.......”=-._......“;,,./`..../”............../
...,,,___.\`~,......“~.,....................`.....}............../
............(....`=-,,.......`........................(......;_,,-”
............/.`~,......`-...............................\....../\
.............\`~.*-,.....................................|,./.....\,__
,,_..........}.>-._\...................................|..............`=~-,
.....`=~-,_\_......`\,.................................\
...................`=~-,,.\,...............................\
................................`:,,...........................`\..............__
.....................................`=-,...................,%`>--==``
........................................_\..........._,-%.......`\
...................................,<`.._|_,-&``................`\

Anyway I believe you can turn off the line-buffering mode in Windows console API as well; this means that inputs will be returned to your program without having to press enter. You can "theoretically" take an individual character keystroke this way. This is a little erratic and I have not tested it too much but this little bit of code should be enough to switch line-buffer on/off. I'd advise that you test its effects before use. Lastly I'm no API expert, and this is leisure code only. So it's probably poorly written. That said:
1
2
3
4
5
6
7
8
9
10
11
12
#include "windows.h"
void linebuffer( bool b )
{
	DWORD  mode;
	HANDLE hstdin = GetStdHandle( STD_INPUT_HANDLE ); // Get the input console handle
	GetConsoleMode( hstdin, &mode );

	if (b) mode |=   ENABLE_LINE_INPUT;
	else   mode &= ~(ENABLE_LINE_INPUT); // Set a new mode with desired effect

	SetConsoleMode( hstdin, mode ); // Apply mode to console
}

Pass TRUE to turn it on and FALSE to turn it off. If you do use it tell me how it goes.
Last edited on
The official way is to use kb hooks.
See classic C samples in MSDN (20 years old...)
I don't think we should help these two any more: http://cplusplus.com/forum/beginner/17711/#msg89403

Both of them seem intent on breaking the law, being stupid and immature, talking about cracking computers.
Link appears to be broken.
Topic must have been deleted, then. Basically "August" was talking about exploits and brute forcing (in terms of passwords). While that's kind of a lame subject, it's still against the law; at least in the USA and UK.
hmm... but i don´t think they will manage to, since they never taken a look into the msdn or google^^...
Prevention is better than cure.
By a factor of 16.
(An ounce of prevention is better than a pound of cure.)
Last edited on
Not planing of breaking the law. Im planing to hack Text Twist
Crack or Hack?;)...
Hack and crack same thing when its for a game. im just going to bruteforce the game and beat my friends at that game. the only thing i want this program to do is to type all the words. Thats it.
have fun
Everybody starts small.... <sarcasm>
Last edited on
No need for help. I figured it out PM me if you want to know how
Last edited on
@August
No, you definitely mentioned passwords.
Edit: and also "exploints" or something like that.
Last edited on
closed account (S6k9GNh0)
The orthodox method for exploiting that game is simple. You could hack into some of the flash game;s variables, grab the current tray of lettters, and print all of the current letters in every order possible or you could even compare to a dictionary database and print any word that shows up in the database with the current letters (this prevents most anti-hack measures). As a matter of fact, I think I'll do this to show up some Flash hacking since I haven't done much research into the subject yet. An article to be made.

Now to business:

@ August, your clearly a newbie here. We do NOT take kindly to any exploiting where it's not meant to be exploited. The reason being is it starts serious conflict with these forums and can even give us a terribly bad reputation. I will admit that I hack where it's not meant to be hacked but I don't do anything serious. I'll hack a game like Twist Text to see if I can and to see what I can do. I also do NOT ask for advice on this subject. I self taught everything I currently know by myself.

I'd also like to let you know that you need to read the Terms of Service of the game before you say it's not breaking the law. I'm pretty sure your breaking the law by using a third-party application in mixture with the flash game. I may be wrong but it's Yahoo and all.

Also, I'd like to add that what it looks like your making is some sort of mix of brute force and keylogger mixture. Your original post doesn't even look like it has something to with the game.

@ chrisname, not to be rude, but I think it really doesn't matter. Though prevention is better than the cure, it's not hard to bruteforce something and someone will always try. The best and true prevention is password encryption and database security.

I'm 90% sure that August used unorthodox and/or unclean methods (if having anything to do with C/++ at all) to accomplish what he wanted. I highly recommend you not PM him personally on the subject.
Last edited on
Pages: 12