Skip to content

Generate strong passwords using /dev/urandom 👻

License

Notifications You must be signed in to change notification settings

brannondorsey/pw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Bash Password Generator

Generate strong passwords using /dev/urandom. Creates a 17 character password using a-zA-Z0-9._!@#$%^&*() characters by default.

$ pw
ZScTXCIP6(8vbsFU@

Install

# clone repo
git clone https://github.com/brannondorsey/pw
cd pw

# install in PATH...
sudo cp pw /usr/bin/pw

# or call from directory with
./pw

Usage

Password length and custom character set can be passed as optional first and second arguments respectively. Number of passwords to generate can optionally be passed as the final parameter.

usage: pw [length [characters [num_passwords]]]
$ pw 10 a-zA-Z
KuacEiwjDT

$ pw 15 0-9 
264679522188786

# you must escape special bash characters
$ pw 17 a-z\!\& 
!q!gxglquw&nfrvlv

# generate 10 sh!tty passwords
$ pw 3 dog 10
god
dod
gog
odd
odd
goo
ddd
ogd
gdo
ooo

What it do?

Here is the script:

$ cat pw
#!/bin/sh
# inspired by https://www.unix-ninja.com/p/A_cheat-sheet_for_password_crackers

# usage: pw [length [characters]]
tr -dc "${2:-'a-zA-Z0-9._!@#$%^&*()'}" < /dev/urandom | fold -w "${1:-17}" | head -n "${3:-1}"

About

Generate strong passwords using /dev/urandom 👻

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages