Compare commits

...

10 Commits

Author SHA1 Message Date
yakumo.izuru
764670dec3 Fixed annoying bug on edit() after months of leaving it unnoticed
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@23 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2024-07-13 22:32:13 +00:00
yakumo.izuru
4dcf9fbe8b Release 2.1
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@22 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2023-10-25 01:52:52 +00:00
yakumo.izuru
dc753117e1 Enable list to have two modus operandi, either way it is limited to the password store
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@21 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2023-10-25 01:20:10 +00:00
yakumo.izuru
3df57c1b07 Release v2
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@20 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2023-09-11 16:59:07 +00:00
yakumo.izuru
4f4ec55a23 suppress '.enc' from list output
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@19 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2023-09-10 18:12:36 +00:00
yakumo.izuru
1a74e05fec New major release, ironically enough, no major changes done yet
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@18 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2023-08-24 02:36:05 +00:00
yakumo.izuru
3eb7a1e270 Small revision
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@17 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2023-05-19 00:27:59 +00:00
koizumi.aoi
fe27179e56 Release
Signed-off-by: Aoi K <koizumi.aoi@kyoko-project.wer.ee>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@16 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2022-11-29 22:59:34 +00:00
koizumi.aoi
af62e9bbae Worth a tag?
Signed-off-by: Aoi K <koizumi.aoi@kyoko-project.wer.ee>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@15 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2022-11-29 22:58:24 +00:00
koizumi.aoi
f7bfa34f03 Update configuration format, add switch to install(1) in mkfile
Signed-off-by: Aoi K <koizumi.aoi@kyoko-project.wer.ee>

git-svn-id: https://svn.yakumo.dev/yakumo.izuru/kanako/trunk@14 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
2022-11-26 14:15:17 +00:00
14 changed files with 162 additions and 173 deletions

8
COPYING Normal file
View File

@ -0,0 +1,8 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42.1):
* <yakumo.izuru@chaotic.ninja> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a bottle of sake in return Izuru Yakumo
* ----------------------------------------------------------------------------
*/

15
DPL-2.3
View File

@ -1,15 +0,0 @@
Discordian Public License 2.3 (DPL-2.3)
All Rites Reversed (ĸ) 3188 Aoi Koizumi [Champagne Supernova] <koizumi.aoi@kyoko-project.wer.ee>
Permission is hereby granted, to any person obtaining a copy of this
material without restriction, including but not limited the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the material, subject to the following conditions:
YOU AGREE THAT THERE IS NO GODDESS BUT GODDESS AND SHE IS YOUR GODDESS &
THAT THERE IS NO ERISIAN MOVEMENT BUT THE ERISIAN MOVEMENT AND IT IS THE
ERISIAN MOVEMENT.
HAIL ERIS!
FIVE TONS OF FLAX

14
Makefile Normal file
View File

@ -0,0 +1,14 @@
PREFIX=/usr/local
fmt:
shfmt --posix --write kanako
install:
install -Dm0755 kanako ${DESTDIR}${PREFIX}/bin/kanako
install -Dm0600 kanako.conf.example ${DESTDIR}${PREFIX}/share/examples/kanako/kanako.conf
install -Dm0600 kanako.mdoc ${DESTDIR}${PREFIX}/share/man/man1/kanako.1
install -Dm0600 kanako.conf.mdoc ${DESTDIR}${PREFIX}/share/man/man5/kanako.conf.5
uninstall:
rm -f ${PREFIX}/bin/kanako
rm -f ${PREFIX}/share/examples/kanako/kanako.conf
rm -f ${PREFIX}/share/man/man1/kanako.1 ${PREFIX}/share/man/man5/kanako.conf.5

View File

@ -1,5 +1,5 @@
# kanako (神奈子)
the adaptable password manager. named after [Kanako Yasaka](https://en.touhouwiki.net/wiki/Kanako_Yasaka)
the adaptable password manager. named after [Kanako Yasaka](https://en.touhouwiki.net/wiki/Kanako_Yasaka) from [Touhou 10: Mountain of Faith](https://en.touhouwiki.net/wiki/Mountain_of_Faith)
## Backends supported
* [age](https://age-encryption.org)
@ -9,27 +9,26 @@ the adaptable password manager. named after [Kanako Yasaka](https://en.touhouwik
## Dependencies
* Any of the above, depending how you configured it
* `ls(1)` or `tree(1)` for printing a list
* `tree(1)` for printing a list
* `mandoc(1)` for documentation
* `rm(1)` with the `-i` and `-I` switches
* `strings(1)`, `dd(1)` and `tr(1)` for generating passwords
## Add-ons
### kanako_gen
random username and password generator, requires `busybox(1)`
### kanako_menu
### 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
### kanako-totp
time-based one time password addon for kanako, requires `oathtool(1)`
from oath-toolkit.
## License
* [Discordian Public License, version 2.3](https://gt.kalli.st/novaburst/discordian-public-license/src/branch/discordia/DPL-2.3)
* [Beerware License (Revision 42.1)](COPYING)
## Related software
* [akoizumi/ayu](https://git.shelltalk.net/akoizumi/ayu) [predecessor]
* [beastie/aps](https://codeberg.org/beastie/aps)
* [biox/pa](https://github.com/biox/pa)
* [e-zk/page](https://github.com/e-zk/page)
* [kl3/spm](https://notabug.org/kl3/spm)

13
addons/kanako-menu Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh -e
# $TheSupernovaDuo: kanako,v 1.9 2023/5/18 21:9:33 yakumo_izuru Exp $
readonly kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}"
readonly kanako_store_dir="${kanako_store_dir:-$HOME/.kanako-store}"
if test -f "${kanako_conf_dir}"/kanako.conf; then
. "${kanako_conf_dir}"/kanako.conf
else
echo "Configuration file has not been found!"
exit 1
fi
find . -name '*.enc' | sort | sed 's,^\./,,;s,\.enc$,,' | "${kanako_menu_cmd}" | xargs $(which kanako) -c

1
addons/kanako_totp → addons/kanako-totp Executable file → Normal file
View File

@ -1,4 +1,5 @@
#!/bin/sh -e
# $TheSupernovaDuo: kanako,v 1.9 2023/5/18 21:9:33 yakumo_izuru Exp $
# extracted from https://rgz.ee/bin/pass
totp_seed="$(kanako -v "$@" | grep 'totp: ' | head -n1 | cut -d' ' -f2)"

View File

@ -1,24 +0,0 @@
#!/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

@ -1,12 +0,0 @@
#!/bin/sh -e
readonly kanako_conf_dir="${conf_dir:-$HOME/.config/kanako}"
readonly kanako_store_dir="${store_dir:-$HOME/.kanako-store}"
if test -f "${kanako_conf_dir}"/kanako.conf; then
. "${kanako_conf_dir}"/kanako.conf
else
echo "Configuration file has not been found!"
exit 1
fi
find . -name '*.enc' | sort | sed 's,^\./,,;s,\.enc$,,' | ${menu_prog} | xargs $(which kanako) -c

View File

@ -1,3 +0,0 @@
EXEC_MODE=0755
FILE_MODE=0600
PREFIX=/usr/local

115
kanako
View File

@ -1,77 +1,90 @@
#!/bin/sh -e
#!/bin/sh
# $TheSupernovaDuo: kanako,v 2.1 2023/10/25 01:50:28 yakumo_izuru Exp $
readonly kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}"
readonly kanako_key_dir="${kanako_key_dir:-$HOME/.kanako}"
readonly kanako_store_dir="${kanako_store_dir:-$HOME/.kanako-store}"
if test -d "${kanako_store_dir}"; then
cd "${kanako_store_dir}"
cd "${kanako_store_dir}"
else
echo "Password store not found!"
echo "Create it with mkdir -p $kanako_store_dir"
exit 1
printf "Password store not found!\n"
printf "Create it with mkdir -p %s\n" "$kanako_store_dir"
exit 1
fi
if test -f "${kanako_conf_dir}/kanako.conf"; then
. "${kanako_conf_dir}/kanako.conf";
. "${kanako_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
printf "Configuration file has not been found!\n"
printf "Copy kanako.conf from the examples directory,\n"
printf "and edit accordingly.\n"
exit 1
fi
fn_copy() {
fn_view $1 | "${clip_cmd}"
copy() {
view "$1" | "${kanako_clip_cmd}"
}
fn_edit() {
${encrypt_cmd} ${decrypt_args} ${1%%.enc}.enc > ${1%%.enc}
"${EDITOR}" "${1%%.enc}"
${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
rm "${1%%.enc}"
edit() {
if [ -f ${1%%.enc}.enc ]; then
${kanako_encrypt_cmd} ${kanako_decrypt_args} ${1%%.enc}.enc >${1%%.enc}
"${EDITOR:-${EDITOR:-vi}}" "${1%%.enc}"
${kanako_encrypt_cmd} ${kanako_encrypt_args} ${1%%.enc} >${1%%.enc}.enc
rm "${1%%.enc}"
else
printf "%s does not exist, maybe there was a typo on your end?\n" "${1%%.enc}.enc"
fi
}
fn_list() {
"${list_cmd}" "${store_dir}"
gen() {
printf "%s\n" $(strings </dev/urandom | dd bs=1 count="${1:-30}" 2>/dev/null | tr -d ' \t\n\r')
}
fn_new() {
test -d $1 && fn_usage && exit 1
list() {
if [ -z "$1" ]; then
$(which tree) "${kanako_store_dir}/" | sed 's/\.enc//g'
else
$(which tree) "${1:-.}" | sed 's/\.enc//g'
fi
}
new() {
test -d "$1" && usage
tmpfile="$(mktemp)"
"${EDITOR}" "${tmpfile}"
tmpfile="$(mktemp)"
"${EDITOR:-${EDITOR:-vi}}" "${tmpfile}"
mkdir -p "$(dirname "$1")"
${encrypt_cmd} ${encrypt_args} ${tmpfile} > ${1%%.enc}.enc
rm ${tmpfile}
mkdir -p "$(dirname "$1")"
${kanako_encrypt_cmd} ${kanako_encrypt_args} ${tmpfile} >${1%%.enc}.enc
rm ${tmpfile}
}
fn_trash_directory() {
rm -rf $@
delete_directory() {
rm -r -I "$1"
}
fn_trash_entry() {
rm -f "${1}${2}".enc
delete_file() {
rm -i "${1}${2}".enc
}
fn_usage() {
cat <<EOF
Usage:
kanako [-celnrRv] <arguments>
EOF
usage() {
printf "Usage: %s [-c|-e|-g|-l|-n|-R|-r|-v [file or directory]]\n" "$0"
printf "The arguments for all switches are relative to \${kanako_store_dir}\n"
printf "which is located at %s\n" "${kanako_store_dir}"
exit 1
}
fn_view() {
if [ -f "${1%%.enc}".enc ]; then
${encrypt_cmd} ${decrypt_args} "${1%%.enc}".enc
elif [ -d "${1:-.}" ]; then
${list_cmd} "${1:-.}"
else
fn_usage
fi
view() {
if [ -f "${1%%.enc}".enc ]; then
${kanako_encrypt_cmd} ${kanako_decrypt_args} "${1%%.enc}".enc
elif [ -d "${1:-.}" ]; then
list "${1:-.}"
else
usage
fi
}
case $1 in
-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 ;;
-c) copy $2 ;;
-e) edit $2 ;;
-g) gen $2 ;;
-l) list $2 ;;
-n) new $2 ;;
-R) delete_directory $2 ;;
-r) delete_file $2 ;;
-v) view $2 ;;
*) usage ;;
esac

View File

@ -1,25 +1,25 @@
# Configuration file for kanako(1)
#clip="xclip -i"
#clip="wl-copy --primary"
#list_cmd="tree"
#kanako_clip_cmd="xclip -i"
#kanako_clip_cmd="wl-copy --primary"
#kanako_menu_cmd="dmenu"
## age
#encrypt_cmd="age"
#encrypt_args="-e -R ${key_dir}/pub.age --armor"
#decrypt_args="-d -i ${key_dir}/priv.age"
#kanako_encrypt_cmd="age"
#kanako_encrypt_args="-e -R ${kanako_key_dir}/pub.key --armor"
#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.key"
## cream
#encrypt_cmd="cream"
#encrypt_args="-e -f"
#decrypt_args="-d"
#kanako_encrypt_cmd="cream"
#kanako_encrypt_args="-e -f"
#kanako_decrypt_args="-d"
## gpg
#encrypt_cmd="gpg"
#encrypt_args="-e --recipient ${key_dir}/pub.gpg"
#decrypt_args="-d"
#kanako_encrypt_cmd="gpg"
#kanako_encrypt_args="-e --recipient ${kanako_key_dir}/pub.key"
#kanako_decrypt_args="-d"
## salty
#encrypt_cmd="salty"
#encrypt_args="-e -r $(cat ${key_dir}/pub.slt)"
#decrypt_args="-d -i ${key_dir}/priv.slt"
#kanako_encrypt_cmd="salty"
#kanako_encrypt_args="-e -r $(cat ${kanako_key_dir}/pub.slt)"
#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.slt"

View File

@ -1,33 +1,30 @@
.Dd Bureaucracy 65, 3188
.Dd $Mdocdate$
.Dt KANAKO.CONF 5
.Os
.Sh NAME
.Nm kanako.conf
.Nd configuration file for
.Xr kanako 1
.Sh KEYS
.Ss General section
.Sh FIELDS
.Bl -tag -width 11n -compact
.It clip_cmd
Clipboard executable to use with
the program.
.It list_cmd
Listing executable to use
with the program.
.El
.Ss Encryption section
.Bl -tag -width 11n -compact
.It encrypt_cmd
Command to handle encryption
.It encrypt_args
Options to be passed to
encrypt_cmd for encryption
.It decrypt_args
Options to be passed to
encrypt_cmd for decryption
.It kanako_clip_cmd
Clipboard executable to be
used with the -c switch
.It kanako_decrypt_args
Arguments for decryption
passed to kanako_encrypt_cmd
.It kanako_encrypt_args
Arguments for encryption
passed to kanako_encrypt_cmd
.It kanako_encrypt_cmd
Encryption executable to
be used with the program
.It kanako_menu_cmd
Menu executable to
be used with kanako_menu
.El
.Sh SEE ALSO
.Xr kanako 1
.Sh AUTHORS
.An Aoi Koizumi Aq Mt koizumi.aoi@kyoko-project.wer.ee
.An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja

View File

@ -1,11 +1,22 @@
.Dd Bureaucracy 72, 3188
.Dd $Mdocdate$
.Dt KANAKO 1
.Os
.Sh NAME
.Nm kanako
.Nd the adaptable password manager
.Sh SYNOPSIS
.Nm
.Op Fl ceglnrRv
.Op Ar args
.Sh DESCRIPTION
It is a clean rewrite of
.Xr ayu 1
supporting multiple backends
and having more add-ons for
use with it. However, it
may be pretty unstable compared
to said tool, but should work
well for its purpose.
.Sh USAGE
.Bl -tag -width 11n -compact
.It -n
@ -14,18 +25,23 @@ Add a new entry
Copy an entry's text to the clipboard
.It -e
Edit an entry
.It -g
Generate a random password
.It -l
List all entries
.It -r
Remove single entries
Remove single entries,
will prompt for confirmation
.It -R
Remove recursively a directory w/ entries
Remove recursively a directory w/ entries,
will prompt for confirmation
.It -v
View an entry
.Bl
.El
.Sh SEE ALSO
.Xr age 1
.Xr cream 1
.Xr gpg 1
.Xr kanako.conf 5
.Xr pwgen 1
@ -37,7 +53,7 @@ View an entry
.%D 1983
.Re
.Sh AUTHORS
.An Aoi Koizumi Aq Mt koizumi.aoi@kyoko-project.wer.ee
.An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja
.Sh BUGS
Under the Wayland display protocol,
the clipboard subcommand won't work,

18
mkfile
View File

@ -1,18 +0,0 @@
<config.mk
install:V: install-bin install-examples install-man
uninstall:V: uninstall-bin uninstall-examples uninstall-man
install-bin:
install -m$EXEC_MODE kanako $PREFIX/bin/kanako
install-examples:
install -m$FILE_MODE kanako.conf.example $PREFIX/share/examples/kanako/kanako.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
uninstall-examples:
rm -f $PREFIX/share/examples/kanako/kanako.conf $PREFIX/share/exmaples/kanako/kanakomenu.conf
uninstall-man:
rm -f $PREFIX/share/man/man1/kanako.1 $PREFIX/share/man/man5/kanako.conf.5