mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-23 05:01:37 +01:00
Renamed to list-random-passwords.ps1
This commit is contained in:
parent
6313a58629
commit
c40d0fa110
@ -19,7 +19,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
|
||||
* [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) - lists the PowerShell cmdlets
|
||||
* [list-earthquakes.ps1](Scripts/list-earthquakes.ps1) - lists earthquakes >= 6.0 for the last 30 days
|
||||
* [list-modules.ps1](Scripts/list-modules.ps1) - lists the PowerShell modules
|
||||
* [list-passwords.ps1](Scripts/list-passwords.ps1) - generates and prints a list of new passwords
|
||||
* [list-random-passwords.ps1](Scripts/list-random-passwords.ps1) - prints a list of random passwords
|
||||
* [list-processes.ps1](Scripts/list-processes.ps1) - lists the local computer processes
|
||||
* [locate-city.ps1](Scripts/locate-city.ps1) - prints the geographic location of the given city
|
||||
* [locate-ipaddress.ps1](Scripts/locate-ipaddress.ps1) - prints the geographic location of the given IP address
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./list-passwords.ps1
|
||||
# Description: generates and prints a list of new passwords
|
||||
# Syntax: ./list-random-passwords.ps1
|
||||
# Description: prints a list of random passwords
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
@ -9,10 +9,10 @@
|
||||
$CharsPerPassword = 15
|
||||
$MinCharCode = 33
|
||||
$MaxCharCode = 126
|
||||
$NumLines = 24
|
||||
$NumColumns = 6
|
||||
$Lines = 24
|
||||
$Columns = 6
|
||||
|
||||
function new_password() {
|
||||
function GeneratePassword() {
|
||||
$password = ""
|
||||
$generator = New-Object System.Random
|
||||
for ($i = 0; $i -lt $CharsPerPassword; $i++) {
|
||||
@ -22,9 +22,9 @@ function new_password() {
|
||||
}
|
||||
|
||||
try {
|
||||
for ($j = 0; $j -lt $NumLines; $j++) {
|
||||
for ($k = 0; $k -lt $NumColumns; $k++) {
|
||||
$password = new_password
|
||||
for ($j = 0; $j -lt $Lines; $j++) {
|
||||
for ($k = 0; $k -lt $Columns; $k++) {
|
||||
$password = GeneratePassword
|
||||
Write-Host -NoNewline "$password "
|
||||
}
|
||||
Write-Host ""
|
Loading…
Reference in New Issue
Block a user