Don't be an idiot, $env:username



  • While looking for a way to script user creation on a filezilla server, I stumbled upon this.

    [code]#Generate a form to capture the new password and perform some rudimentary validation
    $ftpPassword = formCaptureText $formTitle "Please enter the new (strong) password below:"
    while (($ftpPassword.Length -lt 8) -or ($ftpPassword -eq $ftpUsername) -or ($ftpPassword -match "123"))
    {
    if ($ftpPassword -eq ""){write-host "Empty password. Exiting now";exit} #If password is empty, quit.
    $ftpPassword = formCaptureText $formTitle "Don't be an idiot, $env:username. Enter a proper /strong/ password below. You can generate them at http://strongpasswordgenerator.com/:"
    }[/code]

    I should added a case for the infamous "hunter2" password.
    [code]
    #PASSWORD
    $ftpPassword = formCaptureText $formTitle "Please enter the new (strong) password below:"
    While (($ftpPassword.Length -LT 8) -Or ($ftpPassword -EQ $ftpUsername) -Or ($ftpPassword -Match "123") -Or ($ftpPassword -Match "hunter2"))
    {
    If ($ftpPassword -EQ "")
    {
    Write-Host "Empty password. Exiting now"
    Exit
    }
    $ftpPassword = formCaptureText $formTitle "Don't be an idiot, $env:username. Enter a proper /strong/ password below. You can generate them at http://strongpasswordgenerator.com/."
    }[/code]



  • Needs more SPANK and COMPLAIN.


Log in to reply