Created
April 29, 2017 10:40
-
-
Save sillyfellow/7c071f158950910e050f0c1b9d8503c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate an alphanumeric 16 character password | |
randpw() { | |
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16} | |
echo | |
} | |
# Generate a 16 character password where the adjacent characters are typed with different hands (left/right) | |
randpwmix() { | |
LEFT=$(randpwleft) | |
RIGHT=$(randpwright) | |
python -c "print(''.join(''.join(x) for x in zip('${LEFT}', '${RIGHT}')))" | |
} | |
# A password which can be printed only by left hand | |
randpwleft() { | |
</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8 | |
echo "" | |
} | |
# A password which can be printed by right hand alone | |
randpwright() { | |
</dev/urandom tr -dc '67890-=^&*()_+yuiop[]YUIOP{}hjkl;HJKL:"nm,./NM<>?' | head -c8 | |
echo "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment