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 | [Reflection.Assembly]::LoadWithPartialName("System.Web") function validar { param ( [String[]]$usuario,$password ) begin { $infodelogin = Get-Content .\login.txt $passusuariohash = [System.Web.Security.FormsAuthentication]::HashPasswordForStoringInConfigFile($password, "SHA256") } process { if($usuario -eq $infodelogin.Split(",")[0] -and $passusuariohash -eq $infodelogin.Split(",")[1]) { $ok = $true } else { $ok = $false } } end { if($ok -eq $true) { "correcto "+(Get-Date) | Out-File logcorrecto.txt -Append } else { "incorrecto "+(Get-Date) | Out-File logcorrecto.txt -Append } } } |