mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-19 19:27:52 +02: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-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-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-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
|
* [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-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
|
* [locate-ipaddress.ps1](Scripts/locate-ipaddress.ps1) - prints the geographic location of the given IP address
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/snap/bin/powershell
|
#!/snap/bin/powershell
|
||||||
|
|
||||||
# Syntax: ./list-passwords.ps1
|
# Syntax: ./list-random-passwords.ps1
|
||||||
# Description: generates and prints a list of new passwords
|
# Description: prints a list of random passwords
|
||||||
# Author: Markus Fleschutz
|
# Author: Markus Fleschutz
|
||||||
# Source: github.com/fleschutz/PowerShell
|
# Source: github.com/fleschutz/PowerShell
|
||||||
# License: CC0
|
# License: CC0
|
||||||
@ -9,10 +9,10 @@
|
|||||||
$CharsPerPassword = 15
|
$CharsPerPassword = 15
|
||||||
$MinCharCode = 33
|
$MinCharCode = 33
|
||||||
$MaxCharCode = 126
|
$MaxCharCode = 126
|
||||||
$NumLines = 24
|
$Lines = 24
|
||||||
$NumColumns = 6
|
$Columns = 6
|
||||||
|
|
||||||
function new_password() {
|
function GeneratePassword() {
|
||||||
$password = ""
|
$password = ""
|
||||||
$generator = New-Object System.Random
|
$generator = New-Object System.Random
|
||||||
for ($i = 0; $i -lt $CharsPerPassword; $i++) {
|
for ($i = 0; $i -lt $CharsPerPassword; $i++) {
|
||||||
@ -22,9 +22,9 @@ function new_password() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for ($j = 0; $j -lt $NumLines; $j++) {
|
for ($j = 0; $j -lt $Lines; $j++) {
|
||||||
for ($k = 0; $k -lt $NumColumns; $k++) {
|
for ($k = 0; $k -lt $Columns; $k++) {
|
||||||
$password = new_password
|
$password = GeneratePassword
|
||||||
Write-Host -NoNewline "$password "
|
Write-Host -NoNewline "$password "
|
||||||
}
|
}
|
||||||
Write-Host ""
|
Write-Host ""
|
Loading…
x
Reference in New Issue
Block a user