-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHellofy.au3
78 lines (69 loc) · 2.74 KB
/
Hellofy.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Icons\security.ico
#AutoIt3Wrapper_Outfile=Compiled\Hellofy.exe
#AutoIt3Wrapper_Res_Description=Manages Windows Hello prompt
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_ProductName=Hellofy
#AutoIt3Wrapper_Res_ProductVersion=1.0
#AutoIt3Wrapper_Res_LegalCopyright=GNU AFFERO GENERAL PUBLIC LICENSE
#AutoIt3Wrapper_Res_Language=3081
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;-----------------------------------------------
;Title: Hellofy
;Purpose: Forces Windows Hello prompt to always be in focus
;Date: 05/06/23
;Version: 1.0
;Designer: ados8
;-----------------------------------------------
;Dependencies
#include <File.au3>
#include <StringConstants.au3>
;Global varibles
Global $Delay = 2 ;multiplied later by 1000
Global $DelayPIN = 0 ;Changes based on config file
;Checks for config and deploys default settings
If Not FileExists(@ScriptDir & "\settings.config") Then
MsgBox(16, "Read Me!", "Config file has been made at the script location, please read the GitHub page.")
_FileCreate(@ScriptDir & "\settings.config")
$Config = FileOpen(@ScriptDir & "\settings.config", 2)
FileWrite($Config, "Polling frequency (seconds): " & $Delay & @LF & "PIN mode : No")
FileClose($Config)
EndIf
;Import config settings into app
$Config = FileOpen(@ScriptDir & "\settings.config", 0)
$Settings = FileRead($Config, -1)
;Set polling frequency based on config settings
$Delay = StringRegExp($Settings, '([0-9]{1,3600})', $STR_REGEXPARRAYMATCH)
$Delay = $Delay[0] * 1000 ;converts to milliseconds to bypass reg exp limitation
;Determin if PIN mode is enabled
If StringInStr($Settings, "Yes", 0, 1) = 0 Then
$ModeSelected = "FINGER"
Else
$ModeSelected = "PIN"
$DelayPIN = 1000
EndIf
;Main payload
While 1
;Wait for the existance of Windows Hello window
While WinExists("[CLASS:Credential Dialog Xaml Host]", "") = 0
Sleep($Delay)
WEnd
;Find the last active app which must have triggered the Windows Hello authentication prompt
$ActiveWindowHandle = WinGetHandle("[ACTIVE]")
WinActivate($ActiveWindowHandle)
;While Windows Hello app exists force it and the app which triggered it to remain in focus.
While WinExists("[CLASS:Credential Dialog Xaml Host]", "")
WinActivate("[CLASS:Credential Dialog Xaml Host]")
If $ModeSelected = "FINGER" Then
WinSetState("[CLASS:Credential Dialog Xaml Host]", "", @SW_DISABLE)
Sleep(1000)
WinSetState("[CLASS:Credential Dialog Xaml Host]", "", @SW_ENABLE)
ElseIf $ModeSelected = "PIN" Then
Sleep($DelayPIN)
EndIf
If WinExists("[CLASS:Credential Dialog Xaml Host]", "") = 0 Then
ExitLoop
EndIf
WEnd
WEnd