Moved addons to their own directory. Add kanako_gen, Removed

kanako-init, etc.

Signed-off-by: Aoi K <koizumi.aoi@kyoko-project.wer.ee>

git-svn-id: file:///srv/svn/repo/kanako/trunk@11 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
This commit is contained in:
koizumi.aoi 2022-10-18 21:57:56 +00:00
parent e39dfc294a
commit 8729322382
9 changed files with 60 additions and 62 deletions

View File

@ -1,5 +1,5 @@
# kanako (神奈子)
the adaptable password manager.
the adaptable password manager. named after [Kanako Yasaka](https://en.touhouwiki.net/wiki/Kanako_Yasaka)
## Backends supported
* [age](https://age-encryption.org)
@ -9,17 +9,18 @@ the adaptable password manager.
## Dependencies
* Any of the above, depending how you configured it
* `ls(1)` or `tree(1)` for printing a list
* busybox `tr(1)` for password generation
* `mandoc(1)` for documentation
## Add-ons
### kanakomenu
quick graphical front-end for kanako, works with either of `dmenu(1)`
or `bemenu(1)`, useful for copying passwords to clipboard. it's configured
through kanakomenu.conf
### kanako_gen
random username and password generator, requires `busybox(1)`
### kanakototp
### kanako_menu
quick graphical front-end for kanako, works with either of `dmenu(1)`
or `bemenu(1)`, useful for copying passwords to clipboard.
### kanako_totp
time-based one time password addon for kanako, requires `oathtool(1)`
from oath-toolkit.

24
addons/kanako_gen Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh -e
fn_genpass() {
printf "Password: %s\n" $(busybox tr -dc '[A-Z][a-z][0-9]' </dev/urandom | dd bs=1 count=${1:-80} 2>/dev/null; echo)
}
fn_genuser() {
printf "Username: %s\n" $(busybox tr -dc '[A-Z][a-z][0-9]' </dev/urandom | dd bs=1 count=10 2>/dev/null; echo)
}
case $1 in
-p)
fn_genpass $2
;;
-u)
fn_genuser
;;
*)
cat <<EOF
Usage:
kanako_gen -p <count>
kanako_gen -u
EOF
;;
esac

View File

@ -2,12 +2,10 @@
readonly conf_dir="${conf_dir:-$HOME/.config/kanako}"
readonly store_dir="${store_dir:-$HOME/.kanako-store}"
if test -f "${conf_dir}"/kanakomenu.conf; then
. "${conf_dir}"/kanakomenu.conf
if test -f "${conf_dir}"/kanako.conf; then
. "${conf_dir}"/kanako.conf
else
echo "Configuration file has not been found!"
echo "Copy kanakomenu.conf from the examples directory,"
echo "and edit accordingly"
exit 1
fi

39
kanako
View File

@ -5,20 +5,20 @@ readonly key_dir="${key_dir:-$HOME/.kanako}"
readonly store_dir="${store_dir:-$HOME/.kanako-store}"
if test -d "${store_dir}"; then
cd "${store_dir}"
cd "${store_dir}"
else
echo "Password store not found!"
echo "Please run kanako-init"
exit 1
echo "Password store not found!"
echo "Create it with `mkdir -p $store_dir`"
exit 1
fi
if test -f "${conf_dir}/kanako.conf"; then
. "${conf_dir}/kanako.conf";
. "${conf_dir}/kanako.conf";
else
echo "Configuration file has not been found!"
echo "Copy kanako.conf from the examples directory,"
echo "and edit accordingly."
exit 1
echo "Configuration file has not been found!"
echo "Copy kanako.conf from the examples directory,"
echo "and edit accordingly."
exit 1
fi
fn_copy() {
@ -30,9 +30,6 @@ fn_edit() {
${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
rm "${1%%.enc}"
}
fn_generate() {
busybox tr -dc '[A-Z][a-z][0-9]' </dev/urandom | dd bs=1 count=${1:-80} 2>/dev/null; echo
}
fn_list() {
"${list_cmd}" "${store_dir}"
}
@ -55,8 +52,7 @@ fn_trash_entry() {
fn_usage() {
cat <<EOF
Usage:
kanako [-ceglnrRv] <arguments>
kanako [copy|edit|gen|list|add|trash|trashd|view] <arguments>
kanako [-celnrRv] <arguments>
EOF
}
fn_view() {
@ -70,13 +66,12 @@ fn_view() {
}
case $1 in
-c | copy) fn_copy $2 ;;
-e | edit) fn_edit $2 ;;
-g | gen) fn_generate $2 ;;
-l | list) fn_list ;;
-n | add) fn_new $2 ;;
-r | trash) fn_trash_entry $2 ;;
-R | trashd) fn_trash_directory $2 ;;
-v | view) fn_view $2 ;;
-c) fn_copy $2 ;;
-e) fn_edit $2 ;;
-l) fn_list ;;
-n) fn_new $2 ;;
-r) fn_trash_entry $2 ;;
-R) fn_trash_directory $2 ;;
-v) fn_view $2 ;;
*) fn_usage ;;
esac

View File

@ -1,10 +0,0 @@
#!/bin/sh
readonly conf_dir="$HOME/.config/kanako"
readonly key_dir="$HOME/.kanako"
readonly store_dir="$HOME/.kanako-store"
echo "Initializing kanako(1)"
for i in $conf_dir $key_dir $store_dir; do
mkdir -p $i
done

View File

@ -1,4 +1,4 @@
.Dd Bureaucracy 65, 3188
.Dd Bureaucracy 72, 3188
.Dt KANAKO 1
.Os
.Sh NAME
@ -8,21 +8,19 @@
.Sh USAGE
.Bl -tag -width 11n -compact
.It add, -n
.It -n
Add a new entry
.It copy, -c
.It -c
Copy an entry's text to the clipboard
.It edit, -e
.It -e
Edit an entry
.It gen, -g
Generate a random password
.It list, -l
.It -l
List all entries
.It trash, -r
.It -r
Remove single entries
.It trashd, -R
.It -R
Remove recursively a directory w/ entries
.It view, -v
.It -v
View an entry
.Bl
.El

View File

@ -1,4 +0,0 @@
# Configuration file for kanakomenu(1)
#menu_prog="bemenu -p kanako"
#menu_prog="dmenu -p kanako"

6
mkfile
View File

@ -5,17 +5,13 @@ uninstall:V: uninstall-bin uninstall-examples uninstall-man
install-bin:
install -m$EXEC_MODE kanako $PREFIX/bin/kanako
install -m$EXEC_MODE kanako-init $PREFIX/bin/kanako-init
install -m$EXEC_MODE kanakomenu $PREFIX/bin/kanakomenu
install -m$EXEC_MODE kanakototp $PREFIX/bin/kanakototp
install-examples:
install -m$FILE_MODE kanako.conf.example $PREFIX/share/examples/kanako/kanako.conf
install -m$FILE_MODE kanakomenu.conf.example $PREFIX/share/examples/kanako/kanakomenu.conf
install-man:
install -m$FILE_MODE kanako.mdoc $PREFIX/share/man/man1/kanako.1
install -m$FILE_MODE kanako.conf.mdoc $PREFIX/share/man/man5/kanako.conf.5
uninstall-bin:
rm -f $PREFIX/bin/kanako $PREFIX/bin/kanako-init $PREFIX/bin/kanakomenu $PREFIX/bin/kanakototp
rm -f $PREFIX/bin/kanako
uninstall-examples:
rm -f $PREFIX/share/examples/kanako/kanako.conf $PREFIX/share/exmaples/kanako/kanakomenu.conf
uninstall-man: