Skip to content

Instantly share code, notes, and snippets.

@dstreefkerk
Last active December 20, 2018 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstreefkerk/0e2e78bb16edcc78467e0dbc75ad0a9a to your computer and use it in GitHub Desktop.
Save dstreefkerk/0e2e78bb16edcc78467e0dbc75ad0a9a to your computer and use it in GitHub Desktop.
A quick function to replicate some of the functionality of http://correcthorsebatterystaple.net/
function Get-RandomPassword {
[OutputType([string])]
Param
(
[int]
$Count = 1,
[string]
$Separator = '-'
)
$words = (Invoke-WebRequest 'https://bitbucket.org/jvdl/correcthorsebatterystaple/raw/773dbccc9b9e1320f076c432d600f19785c41792/data/wordlist.txt' | Select-Object -ExpandProperty Content).Split(',')
1..$Count | ForEach-Object {"$([string]::Join($Separator,(1..4 | ForEach-Object {[cultureinfo]::CurrentCulture.TextInfo.ToTitleCase(($words | Get-Random))})))$Separator$(1..99 | Get-Random)"}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment