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 (神奈子) # kanako (神奈子)
the adaptable password manager. the adaptable password manager. named after [Kanako Yasaka](https://en.touhouwiki.net/wiki/Kanako_Yasaka)
## Backends supported ## Backends supported
* [age](https://age-encryption.org) * [age](https://age-encryption.org)
@ -9,17 +9,18 @@ the adaptable password manager.
## Dependencies ## Dependencies
* Any of the above, depending how you configured it * Any of the above, depending how you configured it
* `ls(1)` or `tree(1)` for printing a list * `ls(1)` or `tree(1)` for printing a list
* busybox `tr(1)` for password generation
* `mandoc(1)` for documentation * `mandoc(1)` for documentation
## Add-ons ## Add-ons
### kanakomenu ### kanako_gen
quick graphical front-end for kanako, works with either of `dmenu(1)` random username and password generator, requires `busybox(1)`
or `bemenu(1)`, useful for copying passwords to clipboard. it's configured
through kanakomenu.conf
### 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)` time-based one time password addon for kanako, requires `oathtool(1)`
from oath-toolkit. 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 conf_dir="${conf_dir:-$HOME/.config/kanako}"
readonly store_dir="${store_dir:-$HOME/.kanako-store}" readonly store_dir="${store_dir:-$HOME/.kanako-store}"
if test -f "${conf_dir}"/kanakomenu.conf; then if test -f "${conf_dir}"/kanako.conf; then
. "${conf_dir}"/kanakomenu.conf . "${conf_dir}"/kanako.conf
else else
echo "Configuration file has not been found!" echo "Configuration file has not been found!"
echo "Copy kanakomenu.conf from the examples directory,"
echo "and edit accordingly"
exit 1 exit 1
fi fi

39
kanako
View File

@ -5,20 +5,20 @@ readonly key_dir="${key_dir:-$HOME/.kanako}"
readonly store_dir="${store_dir:-$HOME/.kanako-store}" readonly store_dir="${store_dir:-$HOME/.kanako-store}"
if test -d "${store_dir}"; then if test -d "${store_dir}"; then
cd "${store_dir}" cd "${store_dir}"
else else
echo "Password store not found!" echo "Password store not found!"
echo "Please run kanako-init" echo "Create it with `mkdir -p $store_dir`"
exit 1 exit 1
fi fi
if test -f "${conf_dir}/kanako.conf"; then if test -f "${conf_dir}/kanako.conf"; then
. "${conf_dir}/kanako.conf"; . "${conf_dir}/kanako.conf";
else else
echo "Configuration file has not been found!" echo "Configuration file has not been found!"
echo "Copy kanako.conf from the examples directory," echo "Copy kanako.conf from the examples directory,"
echo "and edit accordingly." echo "and edit accordingly."
exit 1 exit 1
fi fi
fn_copy() { fn_copy() {
@ -30,9 +30,6 @@ fn_edit() {
${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc ${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
rm "${1%%.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() { fn_list() {
"${list_cmd}" "${store_dir}" "${list_cmd}" "${store_dir}"
} }
@ -55,8 +52,7 @@ fn_trash_entry() {
fn_usage() { fn_usage() {
cat <<EOF cat <<EOF
Usage: Usage:
kanako [-ceglnrRv] <arguments> kanako [-celnrRv] <arguments>
kanako [copy|edit|gen|list|add|trash|trashd|view] <arguments>
EOF EOF
} }
fn_view() { fn_view() {
@ -70,13 +66,12 @@ fn_view() {
} }
case $1 in case $1 in
-c | copy) fn_copy $2 ;; -c) fn_copy $2 ;;
-e | edit) fn_edit $2 ;; -e) fn_edit $2 ;;
-g | gen) fn_generate $2 ;; -l) fn_list ;;
-l | list) fn_list ;; -n) fn_new $2 ;;
-n | add) fn_new $2 ;; -r) fn_trash_entry $2 ;;
-r | trash) fn_trash_entry $2 ;; -R) fn_trash_directory $2 ;;
-R | trashd) fn_trash_directory $2 ;; -v) fn_view $2 ;;
-v | view) fn_view $2 ;;
*) fn_usage ;; *) fn_usage ;;
esac 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 .Dt KANAKO 1
.Os .Os
.Sh NAME .Sh NAME
@ -8,21 +8,19 @@
.Sh USAGE .Sh USAGE
.Bl -tag -width 11n -compact .Bl -tag -width 11n -compact
.It add, -n .It -n
Add a new entry Add a new entry
.It copy, -c .It -c
Copy an entry's text to the clipboard Copy an entry's text to the clipboard
.It edit, -e .It -e
Edit an entry Edit an entry
.It gen, -g .It -l
Generate a random password
.It list, -l
List all entries List all entries
.It trash, -r .It -r
Remove single entries Remove single entries
.It trashd, -R .It -R
Remove recursively a directory w/ entries Remove recursively a directory w/ entries
.It view, -v .It -v
View an entry View an entry
.Bl .Bl
.El .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-bin:
install -m$EXEC_MODE kanako $PREFIX/bin/kanako 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-examples:
install -m$FILE_MODE kanako.conf.example $PREFIX/share/examples/kanako/kanako.conf 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-man:
install -m$FILE_MODE kanako.mdoc $PREFIX/share/man/man1/kanako.1 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 install -m$FILE_MODE kanako.conf.mdoc $PREFIX/share/man/man5/kanako.conf.5
uninstall-bin: uninstall-bin:
rm -f $PREFIX/bin/kanako $PREFIX/bin/kanako-init $PREFIX/bin/kanakomenu $PREFIX/bin/kanakototp rm -f $PREFIX/bin/kanako
uninstall-examples: uninstall-examples:
rm -f $PREFIX/share/examples/kanako/kanako.conf $PREFIX/share/exmaples/kanako/kanakomenu.conf rm -f $PREFIX/share/examples/kanako/kanako.conf $PREFIX/share/exmaples/kanako/kanakomenu.conf
uninstall-man: uninstall-man: