Compare commits
4 Commits
ff0632fc0f
...
master
Author | SHA1 | Date | |
---|---|---|---|
7e43c9f1cc | |||
45253b5fce | |||
d32d68c6a1 | |||
d49aabc499 |
35
LICENSE
35
LICENSE
@ -1,24 +1,17 @@
|
|||||||
This is free and unencumbered software released into the public domain.
|
Copyright (C) 2024 Nicolás A. Ortega Froysa <nicolas@ortegas.org>
|
||||||
|
|
||||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
This software is provided 'as-is', without any express or implied
|
||||||
distribute this software, either in source code form or as a compiled
|
warranty. In no event will the authors be held liable for any damages
|
||||||
binary, for any purpose, commercial or non-commercial, and by any
|
arising from the use of this software.
|
||||||
means.
|
|
||||||
|
|
||||||
In jurisdictions that recognize copyright laws, the author or authors
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
of this software dedicate any and all copyright interest in the
|
including commercial applications, and to alter it and redistribute it
|
||||||
software to the public domain. We make this dedication for the benefit
|
freely, subject to the following restrictions:
|
||||||
of the public at large and to the detriment of our heirs and
|
|
||||||
successors. We intend this dedication to be an overt act of
|
|
||||||
relinquishment in perpetuity of all present and future rights to this
|
|
||||||
software under copyright law.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
claim that you wrote the original software. If you use this software
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
in a product, an acknowledgment in the product documentation would be
|
||||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
appreciated but is not required.
|
||||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
misrepresented as being the original software.
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
For more information, please refer to <http://unlicense.org/>
|
|
||||||
|
13
README
13
README
@ -1,13 +0,0 @@
|
|||||||
==========
|
|
||||||
*** d6 ***
|
|
||||||
==========
|
|
||||||
A diceware password generator written in Bash. I believe I've written
|
|
||||||
one before, also called 'd6', but I can't find it anywhere, so I wrote a
|
|
||||||
new one. I'm too lazy to write a real README for this, so just use the
|
|
||||||
`-h` option. To install it just run the `install` command, which is all
|
|
||||||
any Makefile really does anyway. Don't know how to use it? Use the
|
|
||||||
manual page.
|
|
||||||
|
|
||||||
This project is licensed with the Unlicense, because it's literally just
|
|
||||||
something I whipped up in less than an hour. Feel free to use it however
|
|
||||||
you want, just remember that it comes without warranty of any kind.
|
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# d6
|
||||||
|
|
||||||
|
A diceware password generator written in Bash. I believe I've written one
|
||||||
|
before, also called 'd6', but I can't find it anywhere, so I wrote a new one.
|
||||||
|
I'm too lazy to write a real README for this, so just use the `-h` option. To
|
||||||
|
install it just run the `install` command, which is all any Makefile really
|
||||||
|
does anyway. Don't know how to use it? Use the manual page.
|
79
d6.sh
79
d6.sh
@ -1,28 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# This is free and unencumbered software released into the public domain.
|
|
||||||
|
# Copyright (C) 2024 Nicolás Ortega Froysa <nicolas@ortegas.org> All rights reserved.
|
||||||
|
# Author: Nicolás Ortega Froysa <nicolas@ortegas.org>
|
||||||
#
|
#
|
||||||
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
# This software is provided 'as-is', without any express or implied
|
||||||
# distribute this software, either in source code form or as a compiled
|
# warranty. In no event will the authors be held liable for any damages
|
||||||
# binary, for any purpose, commercial or non-commercial, and by any
|
# arising from the use of this software.
|
||||||
# means.
|
|
||||||
#
|
#
|
||||||
# In jurisdictions that recognize copyright laws, the author or authors
|
# Permission is granted to anyone to use this software for any purpose,
|
||||||
# of this software dedicate any and all copyright interest in the
|
# including commercial applications, and to alter it and redistribute it
|
||||||
# software to the public domain. We make this dedication for the benefit
|
# freely, subject to the following restrictions:
|
||||||
# of the public at large and to the detriment of our heirs and
|
|
||||||
# successors. We intend this dedication to be an overt act of
|
|
||||||
# relinquishment in perpetuity of all present and future rights to this
|
|
||||||
# software under copyright law.
|
|
||||||
#
|
#
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
# 1. The origin of this software must not be misrepresented; you must not
|
||||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
# claim that you wrote the original software. If you use this software
|
||||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
# in a product, an acknowledgment in the product documentation would be
|
||||||
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
# appreciated but is not required.
|
||||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
# OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
#
|
||||||
# For more information, please refer to <http://unlicense.org/>
|
# 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
# misrepresented as being the original software.
|
||||||
|
#
|
||||||
|
# 3. This notice may not be removed or altered from any source
|
||||||
|
# distribution.
|
||||||
|
|
||||||
VERSION="1.0"
|
VERSION="1.0"
|
||||||
|
|
||||||
@ -44,7 +42,7 @@ function print_help() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_case() {
|
function test_case() {
|
||||||
if [ $1 != "lower" ] && [ $1 != "upper" ] && [ $1 != "capital" ]
|
if [ "$1" != "lower" ] && [ "$1" != "upper" ] && [ "$1" != "capital" ]
|
||||||
then
|
then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@ -62,52 +60,59 @@ do
|
|||||||
case $arg in
|
case $arg in
|
||||||
v)
|
v)
|
||||||
echo "d6 v$VERSION"
|
echo "d6 v$VERSION"
|
||||||
exit 0;;
|
exit 0
|
||||||
|
;;
|
||||||
h)
|
h)
|
||||||
print_help
|
print_help
|
||||||
exit 0;;
|
exit 0
|
||||||
|
;;
|
||||||
n)
|
n)
|
||||||
NUM_WORDS=$OPTARG;;
|
NUM_WORDS=$OPTARG
|
||||||
|
;;
|
||||||
f)
|
f)
|
||||||
WORDLIST="$OPTARG";;
|
WORDLIST="$OPTARG"
|
||||||
|
;;
|
||||||
d)
|
d)
|
||||||
DELIMITER="$OPTARG";;
|
DELIMITER="$OPTARG"
|
||||||
|
;;
|
||||||
c)
|
c)
|
||||||
if test_case $OPTARG
|
if test_case "$OPTARG"
|
||||||
then
|
then
|
||||||
CASE="$OPTARG"
|
CASE="$OPTARG"
|
||||||
else
|
else
|
||||||
echo "'$OPTARG' is an invalid case. Use 'capital', 'lower', or 'upper'."
|
echo "'$OPTARG' is an invalid case. Use 'capital', 'lower', or 'upper'."
|
||||||
exit 1
|
exit 1
|
||||||
fi;;
|
fi
|
||||||
|
;;
|
||||||
?)
|
?)
|
||||||
print_usage
|
print_usage
|
||||||
exit 2
|
exit 2
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
WORDS=""
|
WORDS=""
|
||||||
|
|
||||||
for i in $(seq 1 $NUM_WORDS)
|
for i in $(seq 1 "$NUM_WORDS")
|
||||||
do
|
do
|
||||||
ROLLS=""
|
ROLLS=""
|
||||||
for j in {1..5}
|
for _j in {1..5}
|
||||||
do
|
do
|
||||||
ROLLS="$((1 + $RANDOM % 6))$ROLLS"
|
ROLLS="$((1 + RANDOM % 6))$ROLLS"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $CASE == "upper" ]
|
if [ "$CASE" == "upper" ]
|
||||||
then
|
then
|
||||||
WORD="$(awk "/$ROLLS/{ print toupper(\$2) }" $WORDLIST)"
|
WORD="$(awk "/$ROLLS/{ print toupper(\$2) }" "$WORDLIST")"
|
||||||
elif [ $CASE == "lower" ]
|
elif [ "$CASE" == "lower" ]
|
||||||
then
|
then
|
||||||
WORD="$(awk "/$ROLLS/{ print tolower(\$2) }" $WORDLIST)"
|
WORD="$(awk "/$ROLLS/{ print tolower(\$2) }" "$WORDLIST")"
|
||||||
else
|
else
|
||||||
WORD="$(awk "/$ROLLS/{ print \$2 }" $WORDLIST)"
|
WORD="$(awk "/$ROLLS/{ print \$2 }" "$WORDLIST")"
|
||||||
WORD="${WORD^}"
|
WORD="${WORD^}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $i -eq $NUM_WORDS ]
|
if [ "$i" -eq "$NUM_WORDS" ]
|
||||||
then
|
then
|
||||||
WORDS="${WORDS}${WORD}"
|
WORDS="${WORDS}${WORD}"
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user