Compare commits
10 Commits
9f60ec0ee5
...
764670dec3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
764670dec3 | ||
![]() |
4dcf9fbe8b | ||
![]() |
dc753117e1 | ||
![]() |
3df57c1b07 | ||
![]() |
4f4ec55a23 | ||
![]() |
1a74e05fec | ||
![]() |
3eb7a1e270 | ||
![]() |
fe27179e56 | ||
![]() |
af62e9bbae | ||
![]() |
f7bfa34f03 |
8
COPYING
Normal file
8
COPYING
Normal 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
15
DPL-2.3
@ -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
14
Makefile
Normal 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
|
17
README.md
17
README.md
@ -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
13
addons/kanako-menu
Normal 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
1
addons/kanako_totp → addons/kanako-totp
Executable file → Normal 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)"
|
@ -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
|
@ -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
|
115
kanako
115
kanako
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
26
kanako.mdoc
26
kanako.mdoc
@ -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
18
mkfile
@ -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
|
Loading…
x
Reference in New Issue
Block a user