Initial commit.

This commit is contained in:
Nicolás Ortega Froysa 2020-11-12 12:58:50 +01:00
commit 923ca7f055
3 changed files with 129 additions and 0 deletions

24
LICENSE Normal file
View File

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
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,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
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/>

13
README Normal file
View File

@ -0,0 +1,13 @@
==========
*** 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.

92
d6.sh Executable file
View File

@ -0,0 +1,92 @@
#!/bin/sh
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# 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,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# 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/>
VERSION="1.0"
function print_usage() {
echo "USAGE: d6 [OPTIONS]"
}
function print_help() {
print_usage
echo "OPTIONS:
-v print program version
-h print this help information
-n <num> number of words in generated password (default 3)
-f <file> custom dictionary file (default
~/.local/share/wordlist.txt)
-d <delim> delimiter used between words (default \"\", i.e. NONE)
-c <case> the case used for the generated words, can be: upper,
lower, capital (default \"capital\")"
}
function test_case() {
if [ $1 != "lower" ] && [ $1 != "upper" ] && [ $1 != "capital" ]
then
return 1
else
return 0
fi
}
NUM_WORDS=3
WORDLIST="$HOME/.local/share/wordlist.txt"
DELIMITER=""
CASE="capital"
while getopts "vhn:f:d:c:" arg
do
case $arg in
v)
echo "d6 v$VERSION"
exit 0;;
h)
print_help
exit 0;;
n)
NUM_WORDS=$OPTARG;;
f)
WORDLIST="$OPTARG";;
d)
DELIMITER="$OPTARG";;
c)
if test_case $OPTARG
then
CASE="$OPTARG"
else
echo "'$OPTARG' is an invalid case. Use 'capital', 'lower', or 'upper'."
exit 1
fi;;
?)
print_usage
exit 2
esac
done
echo "NUM_WORDS=$NUM_WORDS"
echo "WORDLIST=$WORDLIST"
echo "DELIMITER=$DELIMITER"
echo "CASE=$CASE"