[Reflection.Assembly]::LoadWithPartialName("System.Web") $hash = [System.Web.Security.FormsAuthentication]::HashPasswordForStoringInConfigFile("hola", "SHA512") $nombreypass="pepito,$hash" $nombreypass | Out-File usuario.txt $usuariometecosas = Read-Host "nombre usuario" $passdeuusariometecosas = Read-Host "password usuario" $hash2 = [System.Web.Security.FormsAuthentication]::HashPasswordForStoringInConfigFile($passdeuusariometecosas, "SHA512") $nombreypasscombrobar = (gc .\usuario.txt) if($nombreypasscombrobar.split(",")[0] -eq $usuariometecosas -and $nombreypasscombrobar.split(",")[1] -eq $hash2) { "hace login" } else { "no hace login" }
Ejercicios de seguridad: hacer un login en el que el password está almacenado en SHA512 en un fichero y el nombre del usuario también está almacenado (Seguridad, PowerShell)
Except where otherwise noted, Jesusninoc by Jesús N. is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.