From ddd4567f5db53058dbefdc40baaf950dcf279cad Mon Sep 17 00:00:00 2001 From: Vincent Composieux Date: Thu, 28 Feb 2019 23:42:03 +0100 Subject: [PATCH] Added oath-toolkit and otp function --- .brew | 1 + .encrypted/.otpkeys | Bin 0 -> 620 bytes .functions | 22 ++++++++++++++++++++++ Makefile | 1 + 4 files changed, 24 insertions(+) create mode 100644 .encrypted/.otpkeys diff --git a/.brew b/.brew index 6f55148..c341424 100755 --- a/.brew +++ b/.brew @@ -23,6 +23,7 @@ brew install ffmpeg brew install fzf brew install rs/tap/jaggr brew install rs/tap/jplot +brew install oath-toolkit brew install prettyping brew install ncdu brew install tmux diff --git a/.encrypted/.otpkeys b/.encrypted/.otpkeys new file mode 100644 index 0000000000000000000000000000000000000000..d168114c804d599350a4ebd10dbf186af6857a09 GIT binary patch literal 620 zcmV-y0+aoP0t^GYPq4}Yi!hP_5CF$G^Cu_Y{#^PL5XBF{GKymw3hNA+FW95B0$>v_ z$vD$`N|tEEAz6Vk3Sf(aUpJ+7r-N6Oh6ww0_$35cTC|4u zI5a|@jb2iME(pij_7IXjg#ZaQ;&V2rSIF1*SSu}A=XPK_?r_$Hw{F$Gf@b9OF6M!6 zIguT*KRcgH)Z~p_*jpz3GOHu`1>O>VreY~4SMZziAMVSRqW@>xgyH#mck4=R>k@*m z*=5c@^&EFVX|_;>V0%0vU_)P#hBpiviAJIcx~15PmI^w@g})`w<{pnqtbpE)YdRlw z=YNu#h47TP)Hmb&Tt%q`;W}JS`HvZB#7*M3C~=`0+2;`g)|$-uJ#NsvvZdmHDBl%C zb1$?D5;8YI<5j6DE#*C#$;6OyF`d6v=lhP(F;m}3q&kLH0&D9(4RwbmS~o!xRO;_~ zeF-s%>$Y?C8k|bbA^?5wMJum2N?bqprF0;GaT}vl_yUKb*Qm`ivtzcnuwn6tnm-Wt zpm&sb4(_f~yU(o9^%DH7SCO%B%G4hdRIO{HhsA@mZkJ9Qs8qn8kdwDOM@&lw7o!w zso{&=?G(T@fwBSGga$g3S$IH}_`|d)XzPL4FrACe+;*=)am+owFmo66xylWn>giPE G0nF^#;WD!T literal 0 HcmV?d00001 diff --git a/.functions b/.functions index 956b047..cb06f56 100644 --- a/.functions +++ b/.functions @@ -279,6 +279,28 @@ function loc() { echo "${fg[white]}Total${reset_color} lines of code: ${fg[yellow]}$total${reset_color}" } +# Returns 2FA code +# Usage: otp +function otp() { + if [ -z $1 ]; then + echo + echo "Usage:" + echo " otp google" + echo + echo "Configuration: $HOME/.otpkeys" + echo "Format: name=key" + return 1; + fi + + OTPKEY=$(sed -n "s/${1}=//p" ~/.otpkeys) + if [ -z $OTPKEY ]; then + echo "$(basename $0): Unknown service name '$1'" + return 1; + fi + + oathtool --totp -b $OTPKEY +} + # Uploads a file to transfer.sh and returns the public URL # Usage: transfer function transfer() { diff --git a/Makefile b/Makefile index b40da40..a804ef3 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ install: ## Installs dotfiles into current environment install-encrypted: ## Installs encrypted dotfiles into current environment @$(MAKE) DOTFILE=.ssh/config install_encrypted_file + @$(MAKE) DOTFILE=.otpkeys install_encrypted_file install_file: @if [ ! -f ${HOME}/${DOTFILE} ]; then \