diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-01-23 22:52:43 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-01-23 22:52:43 +0100 |
| commit | 0bc7e135aaf1600019c573509c3c801b9b1d6cb7 (patch) | |
| tree | 098530408fd7c86a048ee147c1e425329381c1da | |
| parent | a26e6affc58beef0970287499a60ec8fbc5ea170 (diff) | |
| download | scripts-0bc7e135aaf1600019c573509c3c801b9b1d6cb7.tar.gz scripts-0bc7e135aaf1600019c573509c3c801b9b1d6cb7.zip | |
Added secret for password encrypting; changed default directory for sfeed-browser.
| -rw-r--r-- | Makefile | 5 | ||||
| -rwxr-xr-x | secret | 48 | ||||
| -rwxr-xr-x | sfeed-browser | 2 |
3 files changed, 53 insertions, 2 deletions
| @@ -23,6 +23,7 @@ SCRIPTS = addressgrep \ | |||
| 23 | popup-cal12 \ | 23 | popup-cal12 \ |
| 24 | popup-cal3 \ | 24 | popup-cal3 \ |
| 25 | popup-terminal \ | 25 | popup-terminal \ |
| 26 | secret \ | ||
| 26 | sel \ | 27 | sel \ |
| 27 | sfeed-browser \ | 28 | sfeed-browser \ |
| 28 | spawn \ | 29 | spawn \ |
| @@ -40,6 +41,8 @@ SCRIPTS = addressgrep \ | |||
| 40 | xprop-active-window-id \ | 41 | xprop-active-window-id \ |
| 41 | xwallpaper-random-notify | 42 | xwallpaper-random-notify |
| 42 | 43 | ||
| 44 | all: install | ||
| 45 | |||
| 43 | install: | 46 | install: |
| 44 | for s in ${SCRIPTS}; do\ | 47 | for s in ${SCRIPTS}; do\ |
| 45 | cp -f $$s ${DESTDIR}${PREFIX}/bin ; \ | 48 | cp -f $$s ${DESTDIR}${PREFIX}/bin ; \ |
| @@ -49,4 +52,4 @@ install: | |||
| 49 | uninstall: | 52 | uninstall: |
| 50 | for s in ${SCRIPTS}; do rm -rf ${DESTDIR}${PREFIX}/bin/$$s ; done | 53 | for s in ${SCRIPTS}; do rm -rf ${DESTDIR}${PREFIX}/bin/$$s ; done |
| 51 | 54 | ||
| 52 | .PHONY: install uninstall | 55 | .PHONY: all install uninstall |
| @@ -0,0 +1,48 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Encrypt and decrypt files using a fixed cipher and passphrase. | ||
| 4 | # The first line of the (unencrypted) file is considered the "password", the | ||
| 5 | # rest can be anything. | ||
| 6 | |||
| 7 | # Usage: secret command file | ||
| 8 | # Available commands: | ||
| 9 | # clip: copy the secret to clipboard; deleted after 10 seconds | ||
| 10 | # edit: edit or add a file | ||
| 11 | # show: show the full encrypted file | ||
| 12 | |||
| 13 | # Requires: openssl | ||
| 14 | |||
| 15 | opts="aes-256-cbc -iter 1000" # options for openssl | ||
| 16 | timeout=10 # timeout for clip, in ms | ||
| 17 | editor=${EDITOR:-vi} | ||
| 18 | |||
| 19 | if [ -z "$1" ] || [ -z "$2" ]; then | ||
| 20 | echo "usage: secret command file" | ||
| 21 | else | ||
| 22 | case "$1" in | ||
| 23 | clip) | ||
| 24 | openssl $opts -d < "$2" | head -n 1 | xargs printf "%s" | xsel -ib | ||
| 25 | sleep $timeout && xsel -db & | ||
| 26 | ;; | ||
| 27 | edit) | ||
| 28 | tempfile=$(mktemp) | ||
| 29 | if [ -f "$2" ]; then | ||
| 30 | openssl $opts -d < "$2" > "$tempfile" | ||
| 31 | fi | ||
| 32 | $editor "$tempfile" | ||
| 33 | read -p "Are you sure? [N/yes] " an | ||
| 34 | if [ "$an" = yes ] || [ "$an" = Yes ] || [ "$an" = YES ]; then | ||
| 35 | openssl $opts < "$tempfile" > "$2" | ||
| 36 | else | ||
| 37 | echo "Changes discarded" | ||
| 38 | fi | ||
| 39 | rm "$tempfile" | ||
| 40 | ;; | ||
| 41 | show) | ||
| 42 | openssl $opts -d < "$2" | ||
| 43 | ;; | ||
| 44 | *) | ||
| 45 | echo "$1: not a valid command" | ||
| 46 | ;; | ||
| 47 | esac | ||
| 48 | fi | ||
diff --git a/sfeed-browser b/sfeed-browser index be56d74..abdc898 100755 --- a/sfeed-browser +++ b/sfeed-browser | |||
| @@ -17,7 +17,7 @@ filepicker="dmenu-filepicker" # Try "nnn -p -" | |||
| 17 | menu=${MENU:-dmenu} | 17 | menu=${MENU:-dmenu} |
| 18 | menuopts="-l 35 -i" | 18 | menuopts="-l 35 -i" |
| 19 | urlopener=open-url | 19 | urlopener=open-url |
| 20 | sfd="$XDG_CONFIG_HOME/sfeed" | 20 | sfd="box/sfeed" |
| 21 | showlast=10 | 21 | showlast=10 |
| 22 | 22 | ||
| 23 | # Might add more stuff later | 23 | # Might add more stuff later |
