nullpo-head / WSL-Hello-sudo

Let's sudo by face recognition of Windows Hello on Windows Subsystem for Linux (WSL). It runs on both WSL 1 and WSL 2. This is a PAM module for Linux on WSL.
MIT License
1.22k stars 47 forks source link

Authenticator fails to find valid window when Hello detection returns false #25

Open BlackHoleFox opened 3 years ago

BlackHoleFox commented 3 years ago

In the case that Windows Hello isn't supported, but a key is still generated (or you just run the WindowsHelloAuthenticator` binary by hand), it fails to upon the expected error UI box.

Output:

> sudo whoami

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.Exception: Invalid window handle.

This API must be called from a thread with a CoreWindow or a window must have been set explicitly.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at WindowsHelloAuthenticator.Program.<VerifyUser>d__9.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at WindowsHelloAuthenticator.Program.Main(String[] args)

This all said, I'm not sure if there's actually a way to open a window on the desktop from WSL like this.

System details: WSL Version: 1, Ubuntu 18 OS Info: Windows 10 Pro, 19043.1288 Terminal: Windows Terminal Preview