1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#Read MD5 file userpass.txt, example content: # 24c9e15e52afc47c225b757e7bee1f9d,4604c8f5d958fea18967bbc7504d0f03 # user1,passwoasdfK$ [Reflection.Assembly]::LoadWithPartialName("System.Web") #Read user and password $user=Read-Host $pass=Read-Host #Convert user and pass to MD5 and compare #MD5 $result1='' $result2='' $result1 = [System.Web.Security.FormsAuthentication]::HashPasswordForStoringInConfigFile($user, "MD5") $result2 = [System.Web.Security.FormsAuthentication]::HashPasswordForStoringInConfigFile($pass, "MD5") # Is correct? Get-Content userpass.txt | % {if(($_.split(",")[0] -like $result1) -and ($_.split(",")[1] -like $result2)){"Login OK"}} |