aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2022-01-23 22:52:43 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2022-01-23 22:52:43 +0100
commit0bc7e135aaf1600019c573509c3c801b9b1d6cb7 (patch)
tree098530408fd7c86a048ee147c1e425329381c1da
parenta26e6affc58beef0970287499a60ec8fbc5ea170 (diff)
downloadscripts-0bc7e135aaf1600019c573509c3c801b9b1d6cb7.tar.gz
scripts-0bc7e135aaf1600019c573509c3c801b9b1d6cb7.zip
Added secret for password encrypting; changed default directory for sfeed-browser.
Diffstat (limited to '')
-rw-r--r--Makefile5
-rwxr-xr-xsecret48
-rwxr-xr-xsfeed-browser2
3 files changed, 53 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index ee3e07f..7d1b83a 100644
--- a/Makefile
+++ b/Makefile
@@ -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
44all: install
45
43install: 46install:
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:
49uninstall: 52uninstall:
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
diff --git a/secret b/secret
new file mode 100755
index 0000000..2b4d470
--- /dev/null
+++ b/secret
@@ -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
15opts="aes-256-cbc -iter 1000" # options for openssl
16timeout=10 # timeout for clip, in ms
17editor=${EDITOR:-vi}
18
19if [ -z "$1" ] || [ -z "$2" ]; then
20 echo "usage: secret command file"
21else
22case "$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 ;;
47esac
48fi
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 -"
17menu=${MENU:-dmenu} 17menu=${MENU:-dmenu}
18menuopts="-l 35 -i" 18menuopts="-l 35 -i"
19urlopener=open-url 19urlopener=open-url
20sfd="$XDG_CONFIG_HOME/sfeed" 20sfd="box/sfeed"
21showlast=10 21showlast=10
22 22
23# Might add more stuff later 23# Might add more stuff later

Generated with cgit - Back to sebastiano.tronto.net