Skip to content

Instantly share code, notes, and snippets.

@Juszczak
Created March 22, 2018 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Juszczak/1e456581a1dca952a3b8aad91872c575 to your computer and use it in GitHub Desktop.
Save Juszczak/1e456581a1dca952a3b8aad91872c575 to your computer and use it in GitHub Desktop.
MacOS LockScreen Util
clang -framework Foundation lock.m -o lock
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
int main () {
NSBundle *bundle = [NSBundle bundleWithPath:@"/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu"];
Class principalClass = [bundle principalClass];
id instance = [[principalClass alloc] init];
[instance performSelector:@selector(_lockScreenMenuHit:) withObject:nil];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment