Can I replace the login screen on a Mac?

Can I replace the Mac OS X login window, / System / Library / CoreServices / loginwindow.app, with a custom login window? ( See my considerations for this .

I am afraid that my Cocoa programming skills are vestigial. I am wondering when I run a trial CGSession (which is an undocumented utility that performs fast user switching) to find out what functions it uses when doing

nm -mg /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession 

that one of the related functions:

 (undefined [lazy bound]) external _CGSCreateLoginSession (from ApplicationServices) 

I did not find the documentation under ApplicationServices. I suspect I'm delving into the interfaces of service providers instead of the interfaces of an application programmer.

I found this really interesting snippet: ( google cache ) ( direct link to the page down , it seems that the site is undergoing reorganization) from an application that claims to switch to the login window, even if fast user switching is disabled.

 #include "CGSInternal.h" int main (int argc, const char * argv[]) { // switch to the login window CGSCreateLoginSession(NULL); return 0; } 

I use CG to refer to CoreGraphics and do not understand that this is related to logging in (except that it is possible to set up a logon dialog for the current user work).

Even if it is not possible to get a replacement for the login window, I would be interested to know what can be done on these lines (by people who don’t work at Apple).

+6
login cocoa macos
source share
2 answers

The login window application is defined as part of the startup configuration in /System/Library/LaunchDaemons/com.apple.loginwindow.plist.

In theory, you can replace the login window with your own, but I don’t know what you need to do in the new application - I think that the login window is a little more than authentication, and setting up a user session β†’ among others, it looks like he performs some running tasks.

I have compiled an application that calls CGSCreateLoginSession, and after launching it, it goes to the login window through a rotating cube. I assume that this requires CoreGraphics - it's just a graphical function that causes a logout at the end.

You can try the InputManager and see that the login window loads the code -> if so, you can change the username NIB (LoginWindowUI.nib) loginwindow and add some buttons to display a new window using the user's browser. Once the student selects a photo for himself, you can autofill the username and password fields in the loginwindow window.

Node is all a theory, and it looks very fragile and insecure.

Good luck.

Edit later

Please note that this is very unsafe, so use with caution - I tried my system a couple of times when I tested this material

It implements a proof of concept concept that introduces code into loginwindow.

 #include <stdio.h> #include <unistd.h> #include <sys/time.h> #include <strings.h> #include <syslog.h> #import <Cocoa/Cocoa.h> #include <execinfo.h> @interface LLApp:NSApplication @end @implementation LLApp - (void)run { syslog(LOG_ERR, "LLApp being run"); [super run]; } @end void my_openlog(const char *ident, int logopt, int facility); typedef struct interpose_s { void * new_func; void * orig_func; } interpose_t; int MyNSApplicationMain(int argc, const char ** argv); static const interpose_t interposers[] __attribute__ ((section("__DATA, __interpose"))) = { { (void *) my_openlog, (void *) openlog }, }; void my_openlog(const char *ident, int logopt, int facility) { openlog(ident, logopt, facility); if(!strcmp(ident, "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow")) { [LLApp poseAsClass:[NSApplication class]]; } else { syslog(LOG_ERR, "Ignoring unknown indent: >%s<", ident); } return; } 

The code is compiled with:

 gcc -Wall -dynamiclib -undefined dynamic_lookup -o ~/Desktop/libinterposers.dylib testin.m -framework Cocoa 

The code loading is based on intermediate allocation, therefore, the startd loginwindow definition must contain an additional record (to enable intermediate allocation in the dynamic linker), that is:

 <key>EnvironmentVariables</key> <dict> <key>DYLD_INSERT_LIBRARIES</key> <string>path_to/Desktop/libinterposers.dylib</string> </dict> 
+18
source share

yes you can use SFAuthorizationPluginView

here is the link to the link in ADC

+3
source share

All Articles