Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
3591caa53e | |||
bb65906290 | |||
|
f9f9ebc7dc | ||
|
97ceafa778 | ||
|
69983554a7 | ||
|
4e23de6712 | ||
|
09c27e7cfd | ||
|
551e36bb84 | ||
|
d561d82ff8 | ||
|
7c02c46acc | ||
|
17b48c392a | ||
|
d52bc56874 | ||
|
d6ef9e7956 | ||
|
3056dc35ad | ||
|
47b943761f | ||
|
c437c7860a |
38
README.md
38
README.md
@ -4,23 +4,38 @@ pwsh-vault - Basic Password Manager written in Bash+Dmenu
|
||||
### Dependencies:
|
||||
|
||||
* **Arch Linux:**
|
||||
* `sudo pacman -S git gcc make coreutils sed expat zip unzip dialog freetype2 libxinerama brotli fontconfig libbsd libmd libpng libx11 libxau libxdmcp libxft libxrender`
|
||||
|
||||
```shell
|
||||
$ sudo pacman -S git gcc make coreutils sed expat zip unzip dialog freetype2 libxinerama \
|
||||
brotli fontconfig libbsd libmd libpng libx11 libxau libxdmcp libxft libxrender
|
||||
````
|
||||
|
||||
* **Debian/Ubuntu:**
|
||||
* `sudo apt install git gcc make coreutils sed zip unzip dialog libexpat1-dev libfreetype-dev libxinerama-dev x11-utils libxft-dev libfreetype6-dev libfontconfig1-dev libpng-dev libbrotli-dev libxrender-dev libmd-dev libxau-dev libbsd-dev libxdmcp-dev`
|
||||
|
||||
```shell
|
||||
$ sudo apt install git gcc make coreutils sed zip unzip dialog libexpat1-dev libmd-dev \
|
||||
libfreetype-dev libxinerama-dev x11-utils libxft-dev libfreetype6-dev libxau-dev \
|
||||
libfontconfig1-dev libpng-dev libbrotli-dev libxrender-dev libbsd-dev libxdmcp-dev
|
||||
````
|
||||
|
||||
* **Windows Cygwin ([apt-cyg](https://github.com/transcode-open/apt-cyg)):**
|
||||
* `apt-cyg install git make coreutils sed zip unzip dialog`
|
||||
|
||||
```shell
|
||||
$ apt-cyg install git make coreutils sed zip unzip dialog
|
||||
````
|
||||
|
||||
* **Android ([Termux](https://termux.com/)):**
|
||||
* `pkg install git make coreutils sed zip unzip dialog`
|
||||
|
||||
```shell
|
||||
$ pkg install git make coreutils sed zip unzip dialog
|
||||
````
|
||||
|
||||
### Build and install (Unix/Linux Posix):
|
||||
|
||||
* Open terminal and run the following commands:
|
||||
|
||||
```shell
|
||||
$ git clone https://github.com/q3aql/pwsh-vault.git
|
||||
$ git clone https://git.q3aql.dev/q3aql/pwsh-vault.git
|
||||
$ cd pwsh-vault
|
||||
$ sudo make install clean
|
||||
````
|
||||
@ -30,7 +45,7 @@ pwsh-vault - Basic Password Manager written in Bash+Dmenu
|
||||
* Open terminal and run the following commands:
|
||||
|
||||
```shell
|
||||
$ git clone https://github.com/q3aql/pwsh-vault.git
|
||||
$ git clone https://git.q3aql.dev/q3aql/pwsh-vault.git
|
||||
$ cd pwsh-vault
|
||||
$ make cygwin
|
||||
````
|
||||
@ -40,7 +55,7 @@ pwsh-vault - Basic Password Manager written in Bash+Dmenu
|
||||
* Open terminal and run the following commands:
|
||||
|
||||
```shell
|
||||
$ git clone https://github.com/q3aql/pwsh-vault.git
|
||||
$ git clone https://git.q3aql.dev/q3aql/pwsh-vault.git
|
||||
$ cd pwsh-vault
|
||||
$ make termux
|
||||
````
|
||||
@ -51,7 +66,7 @@ pwsh-vault - Basic Password Manager written in Bash+Dmenu
|
||||
pwsh-vault
|
||||
```
|
||||
|
||||
<img src="examples/pwsh-vault.png" />
|
||||
<img src="https://git.q3aql.dev/q3aql/pwsh-vault/raw/branch/master/examples/pwsh-vault.png" />
|
||||
|
||||
|
||||
### NCURSES Version:
|
||||
@ -60,7 +75,7 @@ pwsh-vault - Basic Password Manager written in Bash+Dmenu
|
||||
pwsh-vault-dl
|
||||
```
|
||||
|
||||
<img src="examples/pwsh-vault-dl.png" />
|
||||
<img src="https://git.q3aql.dev/q3aql/pwsh-vault/raw/branch/master/examples/pwsh-vault-dl.png" />
|
||||
|
||||
|
||||
### CLI Version:
|
||||
@ -69,18 +84,19 @@ pwsh-vault - Basic Password Manager written in Bash+Dmenu
|
||||
pwsh-vault-cli
|
||||
```
|
||||
|
||||
<img src="examples/pwsh-vault-cli.png" />
|
||||
<img src="https://git.q3aql.dev/q3aql/pwsh-vault/raw/branch/master/examples/pwsh-vault-cli.png" />
|
||||
|
||||
|
||||
```shell
|
||||
pwsh-vault (or pwsh-vault-cli/dl) --help
|
||||
```
|
||||
|
||||
<img src="examples/pwsh-vault-help.png" />
|
||||
<img src="https://git.q3aql.dev/q3aql/pwsh-vault/raw/branch/master/examples/pwsh-vault-help.png" />
|
||||
|
||||
|
||||
### External links:
|
||||
|
||||
* [dmenu homepage](https://tools.suckless.org/dmenu/)
|
||||
* [dialog homepage](https://invisible-island.net/dialog/dialog.html#download)
|
||||
* [apt-cyg](https://github.com/transcode-open/apt-cyg)
|
||||
* [Cygwin](https://www.cygwin.com/)
|
||||
|
@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Name=pwsh-vault-dl
|
||||
GenericName=pwsh-vault-dl
|
||||
Name=Pwsh Vault Password Manager (DL)
|
||||
GenericName=Pswh Vault Password Manager (DL)
|
||||
Comment=Basic Password Manager written in Bash+Dmenu
|
||||
Comment[es]=Gestor de claves basico escrito en Bash+Dmenu
|
||||
Exec=/usr/bin/pwsh-vault-dl
|
||||
|
@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Name=pwsh-vault
|
||||
GenericName=pwsh-vault
|
||||
Name=Pwsh Vault Password Manager
|
||||
GenericName=Pwsh Vault Password Manager
|
||||
Comment=Basic Password Manager written in Bash+Dmenu
|
||||
Comment[es]=Gestor de claves basico escrito en Bash+Dmenu
|
||||
Exec=/usr/bin/pwsh-vault
|
||||
|
@ -5,9 +5,9 @@
|
||||
# Author: q3aql #
|
||||
# Contact: q3aql@duck.com #
|
||||
# License: GPL v2.0 #
|
||||
# Last-Change: 24-06-20222 #
|
||||
# Last-Change: 17-07-20222 #
|
||||
# ###########################################################
|
||||
VERSION="0.1"
|
||||
VERSION="0.2"
|
||||
|
||||
# Variables
|
||||
pwsh_vault="${HOME}/.pwsh-vault"
|
||||
@ -43,6 +43,28 @@ function removeSpaces() {
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function removeSpacesURL() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
echo "${wordToConvert}" > ${sedtmpfile}
|
||||
# Remove spaces
|
||||
sed -i 's/ /%/g' "${sedtmpfile}" &> /dev/null
|
||||
# Show file without spaces
|
||||
wordToConvert=$(cat ${sedtmpfile})
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function spaceForDot() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
echo "${wordToConvert}" > ${sedtmpfile}
|
||||
# Remove spaces
|
||||
sed -i 's/ /·/g' "${sedtmpfile}" &> /dev/null
|
||||
# Show file without spaces
|
||||
wordToConvert=$(cat ${sedtmpfile})
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function restoreSpaces() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
@ -109,10 +131,20 @@ function vault_key_decrypt() {
|
||||
function generate_password() {
|
||||
if [ -z "${1}" ] ; then
|
||||
default_long_password=20
|
||||
elif [ ${1} -lt 8 ] ; then
|
||||
else
|
||||
expr ${1} + 1 &> /dev/null
|
||||
num_error=$?
|
||||
if [ ${num_error} -ne 0 ] ; then
|
||||
size_pass=20
|
||||
else
|
||||
size_pass="${1}"
|
||||
fi
|
||||
# Create password
|
||||
if [ ${size_pass} -lt 8 ] ; then
|
||||
default_long_password=10
|
||||
else
|
||||
default_long_password=${1}
|
||||
default_long_password=${size_pass}
|
||||
fi
|
||||
fi
|
||||
count_char_password=1
|
||||
current_password=""
|
||||
@ -187,6 +219,15 @@ function create_login_vault_entry() {
|
||||
echo -n "# Enter Name for Login Entry: " ; read name_entry
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/logins/${name_entry}" ] ; then
|
||||
echo ""
|
||||
echo "# Vault logins/${name_entry} already exists"
|
||||
echo "# You can remove or edit it"
|
||||
echo ""
|
||||
echo -n "# Press enter key to continue " ; read enter_continue
|
||||
new_entry=""
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/logins/${name_entry}"
|
||||
name_login_entry=1
|
||||
fi
|
||||
@ -195,6 +236,7 @@ function create_login_vault_entry() {
|
||||
while [ ${username_entry} -eq 0 ] ; do
|
||||
echo -n "# Enter Username: " ; read name_username
|
||||
if [ ! -z "${name_username}" ] ; then
|
||||
name_username=$(spaceForDot "${name_username}")
|
||||
name_username=$(vault_key_encrypt "${name_username}")
|
||||
username_text=$(vault_key_encrypt "Username")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/login"
|
||||
@ -206,6 +248,7 @@ function create_login_vault_entry() {
|
||||
while [ ${password_entry} -eq 0 ] ; do
|
||||
echo -n "# Enter Password: " ; read name_password
|
||||
if [ ! -z "${name_password}" ] ; then
|
||||
name_password=$(spaceForDot "${name_password}")
|
||||
name_password=$(vault_key_encrypt "${name_password}")
|
||||
password_text=$(vault_key_encrypt "Password")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/password"
|
||||
@ -217,6 +260,7 @@ function create_login_vault_entry() {
|
||||
while [ ${url_entry} -eq 0 ] ; do
|
||||
echo -n "# Enter URL: " ; read name_url
|
||||
if [ ! -z "${name_url}" ] ; then
|
||||
name_url=$(removeSpacesURL "${name_url}")
|
||||
name_url=$(vault_key_encrypt "${name_url}")
|
||||
url_text=$(vault_key_encrypt "URL")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/url"
|
||||
@ -228,6 +272,7 @@ function create_login_vault_entry() {
|
||||
while [ ${otp_entry} -eq 0 ] ; do
|
||||
echo -n "# Enter OTP (Default: None): " ; read name_otp
|
||||
if [ ! -z "${name_otp}" ] ; then
|
||||
name_otp=$(spaceForDot "${name_otp}")
|
||||
name_otp=$(vault_key_encrypt "${name_otp}")
|
||||
otp_text=$(vault_key_encrypt "OTP")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/otp"
|
||||
@ -270,6 +315,15 @@ function create_bcard_vault_entry() {
|
||||
echo -n "# Enter Name for Bcard Entry: " ; read name_entry
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/bcard/${name_entry}" ] ; then
|
||||
echo ""
|
||||
echo "# Vault bcard/${name_entry} already exists"
|
||||
echo "# You can remove or edit it."
|
||||
echo ""
|
||||
echo -n "# Press enter key to continue " ; read enter_continue
|
||||
new_entry=""
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/bcard/${name_entry}"
|
||||
name_bcard_entry=1
|
||||
fi
|
||||
@ -290,6 +344,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${card_entry} -eq 0 ] ; do
|
||||
echo -n "# Enter Card Number (XXXX-XXXX-XXXX-XXXX): " ; read name_card
|
||||
if [ ! -z "${name_card}" ] ; then
|
||||
name_card=$(spaceForDot "${name_card}")
|
||||
name_card=$(vault_key_encrypt "${name_card}")
|
||||
card_text=$(vault_key_encrypt "Card")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/card"
|
||||
@ -301,6 +356,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${expiry_entry} -eq 0 ] ; do
|
||||
echo -n "# Enter Expiry Date (MM/YY): " ; read name_expiry
|
||||
if [ ! -z "${name_expiry}" ] ; then
|
||||
name_expiry=$(spaceForDot "${name_expiry}")
|
||||
name_expiry=$(vault_key_encrypt "${name_expiry}")
|
||||
expiry_text=$(vault_key_encrypt "Expiry")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/expiry"
|
||||
@ -312,6 +368,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${cvv_entry} -eq 0 ] ; do
|
||||
echo -n "# Enter CVV: " ; read name_cvv
|
||||
if [ ! -z "${name_cvv}" ] ; then
|
||||
name_cvv=$(spaceForDot "${name_cvv}")
|
||||
name_cvv=$(vault_key_encrypt "${name_cvv}")
|
||||
cvv_text=$(vault_key_encrypt "CVV")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/cvv"
|
||||
@ -348,6 +405,15 @@ function create_note_vault_entry() {
|
||||
echo -n "# Enter Name for Note Entry: " ; read name_entry
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/notes/${name_entry}" ] ; then
|
||||
echo ""
|
||||
echo "# Vault notes/${name_entry} already exists"
|
||||
echo "# You can remove or edit it."
|
||||
echo ""
|
||||
echo -n "# Press enter key to continue " ; read enter_continue
|
||||
new_entry=""
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/notes/${name_entry}"
|
||||
name_note_entry=1
|
||||
fi
|
||||
@ -846,6 +912,7 @@ function edit_entry_vault() {
|
||||
read_userame_dc=$(vault_key_decrypt "${read_username}")
|
||||
echo -n "# Enter Username (Default: ${read_userame_dc}): " ; read name_username
|
||||
if [ ! -z "${name_username}" ] ; then
|
||||
name_username=$(spaceForDot "${name_username}")
|
||||
name_username=$(vault_key_encrypt "${name_username}")
|
||||
username_text=$(vault_key_encrypt "Username")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/login"
|
||||
@ -857,6 +924,7 @@ function edit_entry_vault() {
|
||||
read_password_dc=$(vault_key_decrypt "${read_password}")
|
||||
echo -n "# Enter Password (Default: ${read_password_dc}): " ; read name_password
|
||||
if [ ! -z "${name_password}" ] ; then
|
||||
name_password=$(spaceForDot "${name_password}")
|
||||
name_password=$(vault_key_encrypt "${name_password}")
|
||||
password_text=$(vault_key_encrypt "Password")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/password"
|
||||
@ -868,6 +936,7 @@ function edit_entry_vault() {
|
||||
read_url_dc=$(vault_key_decrypt "${read_url}")
|
||||
echo -n "# Enter URL (Default: ${read_url_dc}): " ; read name_url
|
||||
if [ ! -z "${name_url}" ] ; then
|
||||
name_url=$(removeSpacesURL "${name_url}")
|
||||
name_url=$(vault_key_encrypt "${name_url}")
|
||||
url_text=$(vault_key_encrypt "URL")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/url"
|
||||
@ -879,6 +948,7 @@ function edit_entry_vault() {
|
||||
read_otp_dc=$(vault_key_decrypt "${read_otp}")
|
||||
echo -n "# Enter OTP (Default: ${read_otp_dc}): " ; read name_otp
|
||||
if [ ! -z "${name_otp}" ] ; then
|
||||
name_otp=$(spaceForDot "${name_otp}")
|
||||
name_otp=$(vault_key_encrypt "${name_otp}")
|
||||
otp_text=$(vault_key_encrypt "OTP")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/otp"
|
||||
@ -903,6 +973,7 @@ function edit_entry_vault() {
|
||||
read_card_dc=$(vault_key_decrypt "${read_card}")
|
||||
echo -n "# Enter Card Number (Default: ${read_card_dc}): " ; read name_card
|
||||
if [ ! -z "${name_card}" ] ; then
|
||||
name_card=$(spaceForDot "${name_card}")
|
||||
name_card=$(vault_key_encrypt "${name_card}")
|
||||
card_text=$(vault_key_encrypt "Card")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/card"
|
||||
@ -914,6 +985,7 @@ function edit_entry_vault() {
|
||||
read_expiry_dc=$(vault_key_decrypt "${read_expiry}")
|
||||
echo -n "# Enter Expiry Date (Default: ${read_expiry_dc}): " ; read name_expiry
|
||||
if [ ! -z "${name_expiry}" ] ; then
|
||||
name_expiry=$(spaceForDot "${name_expiry}")
|
||||
name_expiry=$(vault_key_encrypt "${name_expiry}")
|
||||
expiry_text=$(vault_key_encrypt "Expiry")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/expiry"
|
||||
@ -925,6 +997,7 @@ function edit_entry_vault() {
|
||||
read_cvv_dc=$(vault_key_decrypt "${read_cvv}")
|
||||
echo -n "# Enter CVV (Default: ${read_cvv_dc}): " ; read name_cvv
|
||||
if [ ! -z "${name_cvv}" ] ; then
|
||||
name_cvv=$(spaceForDot "${name_cvv}")
|
||||
name_cvv=$(vault_key_encrypt "${name_cvv}")
|
||||
cvv_text=$(vault_key_encrypt "cvv")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/cvv"
|
||||
@ -1047,6 +1120,8 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} logins)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
@ -1063,7 +1138,6 @@ function search_entries_vault() {
|
||||
else
|
||||
otp_decrypt="Yes"
|
||||
fi
|
||||
echo ""
|
||||
echo "* Name Entry: logins/${result}"
|
||||
echo "* Login: ${username_decrypt}"
|
||||
echo "* Password: ${password_decrypt}"
|
||||
@ -1071,7 +1145,6 @@ function search_entries_vault() {
|
||||
echo "* OTP: ${otp_decrypt}"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "# Entry logins/${result} CORRUPTED"
|
||||
echo ""
|
||||
fi
|
||||
@ -1124,6 +1197,8 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} logins)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
@ -1140,7 +1215,6 @@ function search_entries_vault() {
|
||||
else
|
||||
otp_decrypt="Yes"
|
||||
fi
|
||||
echo ""
|
||||
echo "* Name Entry: logins/${result}"
|
||||
echo "* Login: ${username_decrypt}"
|
||||
echo "* Password: ${password_decrypt}"
|
||||
@ -1148,7 +1222,6 @@ function search_entries_vault() {
|
||||
echo "* OTP: ${otp_decrypt}"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "# Entry logins/${result} CORRUPTED"
|
||||
echo ""
|
||||
fi
|
||||
@ -1207,6 +1280,8 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} logins)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
@ -1218,7 +1293,6 @@ function search_entries_vault() {
|
||||
url_decrypt=$(vault_key_decrypt "${url_decrypt}")
|
||||
otp_decrypt=$(cat logins/${result}/otp | tail -1 | cut -d ";" -f 2)
|
||||
otp_decrypt=$(vault_key_decrypt "${otp_decrypt}")
|
||||
echo ""
|
||||
echo "* Name Entry: logins/${result}"
|
||||
echo "* Login: ${username_decrypt}"
|
||||
echo "* Password: ${password_decrypt}"
|
||||
@ -1226,7 +1300,6 @@ function search_entries_vault() {
|
||||
echo "* OTP: ${otp_decrypt}"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "# Entry logins/${result} CORRUPTED"
|
||||
echo ""
|
||||
fi
|
||||
@ -1281,6 +1354,8 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} logins)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
@ -1292,7 +1367,6 @@ function search_entries_vault() {
|
||||
url_decrypt=$(vault_key_decrypt "${url_decrypt}")
|
||||
otp_decrypt=$(cat logins/${result}/otp | tail -1 | cut -d ";" -f 2)
|
||||
otp_decrypt=$(vault_key_decrypt "${otp_decrypt}")
|
||||
echo ""
|
||||
echo "* Name Entry: logins/${result}"
|
||||
echo "* Login: ${username_decrypt}"
|
||||
echo "* Password: ${password_decrypt}"
|
||||
@ -1359,6 +1433,8 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_bcard} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} bcard)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
@ -1370,7 +1446,6 @@ function search_entries_vault() {
|
||||
expiry_decrypt=$(vault_key_decrypt "${expiry_decrypt}")
|
||||
cvv_decrypt=$(cat bcard/${result}/cvv | tail -1 | cut -d ";" -f 2)
|
||||
cvv_decrypt=$(vault_key_decrypt "${cvv_decrypt}")
|
||||
echo ""
|
||||
echo "* Name Entry: bcard/${result}"
|
||||
echo "* Owner: ${owner_decrypt}"
|
||||
echo "* Card: ${card_decrypt}"
|
||||
@ -1378,7 +1453,6 @@ function search_entries_vault() {
|
||||
echo "* CVV: ${cvv_decrypt}"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "# Entry bcard/${result} CORRUPTED"
|
||||
echo ""
|
||||
fi
|
||||
@ -1431,6 +1505,8 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_bcard} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} bcard)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
@ -1442,7 +1518,6 @@ function search_entries_vault() {
|
||||
expiry_decrypt=$(vault_key_decrypt "${expiry_decrypt}")
|
||||
cvv_decrypt=$(cat bcard/${result}/cvv | tail -1 | cut -d ";" -f 2)
|
||||
cvv_decrypt=$(vault_key_decrypt "${cvv_decrypt}")
|
||||
echo ""
|
||||
echo "* Name Entry: bcard/${result}"
|
||||
echo "* Owner: ${owner_decrypt}"
|
||||
echo "* Card: ${card_decrypt}"
|
||||
@ -1450,7 +1525,6 @@ function search_entries_vault() {
|
||||
echo "* CVV: ${cvv_decrypt}"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "# Entry bcard/${result} CORRUPTED"
|
||||
echo ""
|
||||
fi
|
||||
@ -1508,18 +1582,18 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_notes} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} notes)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
note_decrypt=$(cat notes/${result}/note | tail -1 | cut -d ";" -f 2)
|
||||
note_decrypt=$(vault_key_decrypt "${note_decrypt}")
|
||||
note_decrypt=$(restoreSpaces "${note_decrypt}")
|
||||
echo ""
|
||||
echo "* Name Entry: notes/${result}"
|
||||
echo "* Note: ${note_decrypt}"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "# Entry notes/${result} CORRUPTED"
|
||||
echo ""
|
||||
fi
|
||||
@ -1572,18 +1646,18 @@ function search_entries_vault() {
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
echo ""
|
||||
echo "# Decrypting Entry Number ${search_show_entry}"
|
||||
result=$(cat ${pwsh_vault_cache_notes} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
|
||||
corrupted_result=$(check_corrupted_entry_vault ${result} notes)
|
||||
if [ ${corrupted_result} -eq 0 ] ; then
|
||||
note_decrypt=$(cat notes/${result}/note | tail -1 | cut -d ";" -f 2)
|
||||
note_decrypt=$(vault_key_decrypt "${note_decrypt}")
|
||||
note_decrypt=$(restoreSpaces "${note_decrypt}")
|
||||
echo ""
|
||||
echo "* Name Entry: notes/${result}"
|
||||
echo "* Note: ${note_decrypt}"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "# Entry notes/${result} CORRUPTED"
|
||||
echo ""
|
||||
fi
|
||||
|
146
pwsh-vault-dl.sh
146
pwsh-vault-dl.sh
@ -5,9 +5,9 @@
|
||||
# Author: q3aql #
|
||||
# Contact: q3aql@duck.com #
|
||||
# License: GPL v2.0 #
|
||||
# Last-Change: 26-06-20222 #
|
||||
# Last-Change: 17-07-20222 #
|
||||
# #############################################################
|
||||
VERSION="0.1"
|
||||
VERSION="0.2"
|
||||
|
||||
# Variables
|
||||
pwsh_vault="${HOME}/.pwsh-vault"
|
||||
@ -54,6 +54,28 @@ function removeSpaces() {
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function removeSpacesURL() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
echo "${wordToConvert}" > ${sedtmpfile}
|
||||
# Remove spaces
|
||||
sed -i 's/ /%/g' "${sedtmpfile}" &> /dev/null
|
||||
# Show file without spaces
|
||||
wordToConvert=$(cat ${sedtmpfile})
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function spaceForDot() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
echo "${wordToConvert}" > ${sedtmpfile}
|
||||
# Remove spaces
|
||||
sed -i 's/ /·/g' "${sedtmpfile}" &> /dev/null
|
||||
# Show file without spaces
|
||||
wordToConvert=$(cat ${sedtmpfile})
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function restoreSpaces() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
@ -120,10 +142,20 @@ function vault_key_decrypt() {
|
||||
function generate_password() {
|
||||
if [ -z "${1}" ] ; then
|
||||
default_long_password=20
|
||||
elif [ ${1} -lt 8 ] ; then
|
||||
else
|
||||
expr ${1} + 1 &> /dev/null
|
||||
num_error=$?
|
||||
if [ ${num_error} -ne 0 ] ; then
|
||||
size_pass=20
|
||||
else
|
||||
size_pass="${1}"
|
||||
fi
|
||||
# Create password
|
||||
if [ ${size_pass} -lt 8 ] ; then
|
||||
default_long_password=10
|
||||
else
|
||||
default_long_password=${1}
|
||||
default_long_password=${size_pass}
|
||||
fi
|
||||
fi
|
||||
count_char_password=1
|
||||
current_password=""
|
||||
@ -145,10 +177,20 @@ function generate_password() {
|
||||
function gen_password_dl() {
|
||||
if [ -z "${1}" ] ; then
|
||||
default_long_password=20
|
||||
elif [ ${1} -lt 8 ] ; then
|
||||
else
|
||||
expr ${1} + 1 &> /dev/null
|
||||
num_error=$?
|
||||
if [ ${num_error} -ne 0 ] ; then
|
||||
size_pass=20
|
||||
else
|
||||
size_pass="${1}"
|
||||
fi
|
||||
# Create password
|
||||
if [ ${size_pass} -lt 8 ] ; then
|
||||
default_long_password=10
|
||||
else
|
||||
default_long_password=${1}
|
||||
default_long_password=${size_pass}
|
||||
fi
|
||||
fi
|
||||
count_char_password=1
|
||||
current_password=""
|
||||
@ -161,7 +203,8 @@ function gen_password_dl() {
|
||||
}
|
||||
|
||||
function generate_password_menu() {
|
||||
clear
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Loading Password Generator \\" 0 0
|
||||
size_password=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Set the password size (Default: 20):" 0 0)
|
||||
if [ -z "${size_password}" ] ; then
|
||||
size_password=20
|
||||
@ -174,6 +217,8 @@ function generate_password_menu() {
|
||||
function init_masterkey() {
|
||||
if [ -f ${pwsh_vault_masterkey} ] ; then
|
||||
read_masterkey_vault=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --passwordbox "# Enter MasterKey Vault:" 0 0)
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Checking The Entered Masterkey \\" 0 0
|
||||
read_masterkey=$(cat ${pwsh_vault_masterkey} | cut -d ";" -f 2)
|
||||
decrypt_masterkey=$(vault_key_decrypt "${read_masterkey}")
|
||||
if [ "${decrypt_masterkey}" == "${read_masterkey_vault}" ] ; then
|
||||
@ -185,6 +230,8 @@ function init_masterkey() {
|
||||
else
|
||||
masterkey_input=$(dialog --stdout --title "# A masterkey has not yet been defined" --passwordbox "# Enter New MasterKey:" 0 0)
|
||||
masterkey_reinput=$(dialog --stdout --title "# A masterkey has not yet been defined" --passwordbox "# Re-Enter New MasterKey:" 0 0)
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Checking The Entered Masterkey \\" 0 0
|
||||
if [ "${masterkey_input}" == "${masterkey_reinput}" ] ; then
|
||||
echo ""
|
||||
masterkey_name=$(vault_key_encrypt "Masterkey")
|
||||
@ -199,13 +246,19 @@ function init_masterkey() {
|
||||
}
|
||||
|
||||
function create_login_vault_entry() {
|
||||
clear
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Loading Section for Create Entry \\" 0 0
|
||||
name_login_entry=0
|
||||
masterkey_load=$(cat ${pwsh_vault_masterkey})
|
||||
while [ ${name_login_entry} -eq 0 ] ; do
|
||||
name_entry=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Name for Login Entry:" 0 0)
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/logins/${name_entry}" ] ; then
|
||||
dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--msgbox "# Vault logins/${name_entry} already exists\n# You can remove or edit it." 0 0
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/logins/${name_entry}"
|
||||
name_login_entry=1
|
||||
fi
|
||||
@ -214,6 +267,7 @@ function create_login_vault_entry() {
|
||||
while [ ${username_entry} -eq 0 ] ; do
|
||||
name_username=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Username:" 0 0)
|
||||
if [ ! -z "${name_username}" ] ; then
|
||||
name_username=$(spaceForDot "${name_username}")
|
||||
name_username=$(vault_key_encrypt "${name_username}")
|
||||
username_text=$(vault_key_encrypt "Username")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/login"
|
||||
@ -225,6 +279,7 @@ function create_login_vault_entry() {
|
||||
while [ ${password_entry} -eq 0 ] ; do
|
||||
name_password=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Password:" 0 0)
|
||||
if [ ! -z "${name_password}" ] ; then
|
||||
name_password=$(spaceForDot "${name_password}")
|
||||
name_password=$(vault_key_encrypt "${name_password}")
|
||||
password_text=$(vault_key_encrypt "Password")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/password"
|
||||
@ -236,6 +291,7 @@ function create_login_vault_entry() {
|
||||
while [ ${url_entry} -eq 0 ] ; do
|
||||
name_url=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 40)" --inputbox "# Enter URL:" 0 0)
|
||||
if [ ! -z "${name_url}" ] ; then
|
||||
name_url=$(removeSpacesURL "${name_url}")
|
||||
name_url=$(vault_key_encrypt "${name_url}")
|
||||
url_text=$(vault_key_encrypt "URL")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/url"
|
||||
@ -247,6 +303,7 @@ function create_login_vault_entry() {
|
||||
while [ ${otp_entry} -eq 0 ] ; do
|
||||
name_otp=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 40)" --inputbox "# Enter OTP (Default: None):" 0 0)
|
||||
if [ ! -z "${name_otp}" ] ; then
|
||||
name_otp=$(spaceForDot "${name_otp}")
|
||||
name_otp=$(vault_key_encrypt "${name_otp}")
|
||||
otp_text=$(vault_key_encrypt "OTP")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/otp"
|
||||
@ -261,6 +318,8 @@ function create_login_vault_entry() {
|
||||
otp_entry=1
|
||||
fi
|
||||
done
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Checking New Created Entry \\" 0 0
|
||||
name_username=$(vault_key_decrypt "${name_username}")
|
||||
name_password=$(vault_key_decrypt "${name_password}")
|
||||
name_url=$(vault_key_decrypt "${name_url}")
|
||||
@ -277,13 +336,17 @@ function create_login_vault_entry() {
|
||||
}
|
||||
|
||||
function create_bcard_vault_entry() {
|
||||
clear
|
||||
name_bcard_entry=0
|
||||
masterkey_load=$(cat ${pwsh_vault_masterkey})
|
||||
while [ ${name_bcard_entry} -eq 0 ] ; do
|
||||
name_entry=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Name for Bcard Entry:" 0 0)
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/bcard/${name_entry}" ] ; then
|
||||
dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--msgbox "# Vault bcard/${name_entry} already exists\n# You can remove or edit it." 0 0
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/bcard/${name_entry}"
|
||||
name_bcard_entry=1
|
||||
fi
|
||||
@ -304,6 +367,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${card_entry} -eq 0 ] ; do
|
||||
name_card=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 40)" --inputbox "# Enter Card Number (XXXX-XXXX-XXXX-XXXX):" 0 0)
|
||||
if [ ! -z "${name_card}" ] ; then
|
||||
name_card=$(spaceForDot "${name_card}")
|
||||
name_card=$(vault_key_encrypt "${name_card}")
|
||||
card_text=$(vault_key_encrypt "Card")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/card"
|
||||
@ -315,6 +379,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${expiry_entry} -eq 0 ] ; do
|
||||
name_expiry=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Expiry Date (MM/YY):" 0 0)
|
||||
if [ ! -z "${name_expiry}" ] ; then
|
||||
name_expiry=$(spaceForDot "${name_expiry}")
|
||||
name_expiry=$(vault_key_encrypt "${name_expiry}")
|
||||
expiry_text=$(vault_key_encrypt "Expiry")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/expiry"
|
||||
@ -326,6 +391,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${cvv_entry} -eq 0 ] ; do
|
||||
name_cvv=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter CVV:" 0 0)
|
||||
if [ ! -z "${name_cvv}" ] ; then
|
||||
name_cvv=$(spaceForDot "${name_cvv}")
|
||||
name_cvv=$(vault_key_encrypt "${name_cvv}")
|
||||
cvv_text=$(vault_key_encrypt "CVV")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/cvv"
|
||||
@ -350,13 +416,17 @@ function create_bcard_vault_entry() {
|
||||
}
|
||||
|
||||
function create_note_vault_entry() {
|
||||
clear
|
||||
name_note_entry=0
|
||||
masterkey_load=$(cat ${pwsh_vault_masterkey})
|
||||
while [ ${name_note_entry} -eq 0 ] ; do
|
||||
name_entry=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Name for Note Entry:" 0 0)
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/notes/${name_entry}" ] ; then
|
||||
dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--msgbox "# Vault notes/${name_entry} already exists\n# You can remove or edit it." 0 0
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/notes/${name_entry}"
|
||||
name_note_entry=1
|
||||
fi
|
||||
@ -384,7 +454,6 @@ function create_note_vault_entry() {
|
||||
}
|
||||
|
||||
function create_entries_menu() {
|
||||
clear
|
||||
new_entry=$(dialog --stdout --menu "# pwsh-vault-dl ${VERSION}" \
|
||||
0 0 0 l "Login/Website Entry" b "Credit/Bank Card Entry" n "Note Entry" r "Back")
|
||||
if [ "${new_entry}" == "l" ] ; then
|
||||
@ -502,7 +571,6 @@ function import_pwsh_vault_param() {
|
||||
}
|
||||
|
||||
function pwsh_vault_about() {
|
||||
clear
|
||||
dialog --title "# pwsh-vault-dl ${VERSION} | About" \
|
||||
--msgbox "# Software: pwsh-vault-dl ${VERSION}\n# Contact: q3aql <q3aql@duck.com>\n# LICENSE: GPLv2.0" 0 0
|
||||
}
|
||||
@ -582,7 +650,8 @@ function check_corrupted_entry_vault() {
|
||||
}
|
||||
|
||||
function list_entries_vault() {
|
||||
clear
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Loading Vault List Entries \\" 0 0
|
||||
cd ${pwsh_vault}
|
||||
count=1
|
||||
list_logins_count=$(ls -1 logins/ | wc -l)
|
||||
@ -620,7 +689,8 @@ function list_entries_vault() {
|
||||
}
|
||||
|
||||
function change_masterkey_vault() {
|
||||
clear
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Loading Section For Change MasterKey \\" 0 0
|
||||
load_masterkey=$(cat ${pwsh_vault_masterkey} | cut -d ";" -f 2)
|
||||
masterkey_loaded=$(vault_key_decrypt "${load_masterkey}")
|
||||
count_logins=$(ls -1 ${pwsh_vault}/logins/ | wc -l)
|
||||
@ -692,11 +762,12 @@ function change_masterkey_vault() {
|
||||
}
|
||||
|
||||
function remove_entry_vault() {
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Loading Vault List Entries \\" 0 0
|
||||
count_logins=$(ls -1 ${pwsh_vault}/logins/ | wc -l)
|
||||
count_notes=$(ls -1 ${pwsh_vault}/notes/ | wc -l)
|
||||
count_bcard=$(ls -1 ${pwsh_vault}/bcard/ | wc -l)
|
||||
count_total=$(expr ${count_logins} + ${count_notes} + ${count_bcard})
|
||||
clear
|
||||
list_entries_vault_dl="dialog --stdout --menu '# Vault List Entries (${count_total}):' 0 0 0"
|
||||
if [ ${count_logins} -ne 0 ] ; then
|
||||
list_logins=$(ls -1 ${pwsh_vault}/logins/)
|
||||
@ -730,6 +801,8 @@ function remove_entry_vault() {
|
||||
dialog --title "# Selected Entry ${vault_remove_entry}" --yesno "# Are you sure?" 0 0
|
||||
are_you_sure=$?
|
||||
if [ "${are_you_sure}" == "0" ] ; then
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Removing ${vault_remove_entry} Entry \\" 0 0
|
||||
rm -rf "${pwsh_vault}/${vault_remove_entry}"
|
||||
dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --msgbox "# Entry ${vault_remove_entry} Removed" 0 0
|
||||
remove_entry_vault
|
||||
@ -744,11 +817,12 @@ function remove_entry_vault() {
|
||||
}
|
||||
|
||||
function edit_entry_vault() {
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Loading Vault List Entries \\" 0 0
|
||||
count_logins=$(ls -1 ${pwsh_vault}/logins/ | wc -l)
|
||||
count_notes=$(ls -1 ${pwsh_vault}/notes/ | wc -l)
|
||||
count_bcard=$(ls -1 ${pwsh_vault}/bcard/ | wc -l)
|
||||
count_total=$(expr ${count_logins} + ${count_notes} + ${count_bcard})
|
||||
clear
|
||||
list_entries_vault_dl="dialog --stdout --menu '# Vault List Entries (${count_total}):' 0 0 0"
|
||||
if [ ${count_logins} -ne 0 ] ; then
|
||||
list_logins=$(ls -1 ${pwsh_vault}/logins/)
|
||||
@ -778,14 +852,15 @@ function edit_entry_vault() {
|
||||
echo > /dev/null
|
||||
else
|
||||
if [ -d "${pwsh_vault}/${vault_edit_entry}" ] ; then
|
||||
echo ""
|
||||
echo "# Selected Entry ${vault_edit_entry}"
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Preparing For ${pwsh_vault}/${vault_edit_entry} Editing \\" 0 0
|
||||
masterkey_load=$(cat ${pwsh_vault_masterkey})
|
||||
if [ -f "${pwsh_vault}/${vault_edit_entry}/login" ] ; then
|
||||
read_username=$(cat ${pwsh_vault}/${vault_edit_entry}/login | tail -1 | cut -d ";" -f 2)
|
||||
read_userame_dc=$(vault_key_decrypt "${read_username}")
|
||||
name_username=$(dialog --stdout --title "# Selected Entry ${vault_edit_entry} $(generate_spaces 20)" --inputbox "# Enter Username (Default: ${read_userame_dc}):" 0 0)
|
||||
if [ ! -z "${name_username}" ] ; then
|
||||
name_username=$(spaceForDot "${name_username}")
|
||||
name_username=$(vault_key_encrypt "${name_username}")
|
||||
username_text=$(vault_key_encrypt "Username")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/login"
|
||||
@ -797,6 +872,7 @@ function edit_entry_vault() {
|
||||
read_password_dc=$(vault_key_decrypt "${read_password}")
|
||||
name_password=$(dialog --stdout --title "# Selected Entry ${vault_edit_entry} $(generate_spaces 20)" --inputbox "# Enter Password (Default: ${read_password_dc}):" 0 0)
|
||||
if [ ! -z "${name_password}" ] ; then
|
||||
name_password=$(spaceForDot "${name_password}")
|
||||
name_password=$(vault_key_encrypt "${name_password}")
|
||||
password_text=$(vault_key_encrypt "Password")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/password"
|
||||
@ -808,6 +884,7 @@ function edit_entry_vault() {
|
||||
read_url_dc=$(vault_key_decrypt "${read_url}")
|
||||
name_url=$(dialog --stdout --title "# Selected Entry ${vault_edit_entry} $(generate_spaces 40)" --inputbox "# Enter URL (Default: ${read_url_dc}):" 0 0)
|
||||
if [ ! -z "${name_url}" ] ; then
|
||||
name_url=$(removeSpacesURL "${name_url}")
|
||||
name_url=$(vault_key_encrypt "${name_url}")
|
||||
url_text=$(vault_key_encrypt "URL")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/url"
|
||||
@ -819,6 +896,7 @@ function edit_entry_vault() {
|
||||
read_otp_dc=$(vault_key_decrypt "${read_otp}")
|
||||
name_otp=$(dialog --stdout --title "# Selected Entry ${vault_edit_entry} $(generate_spaces 40)" --inputbox "# Enter OTP (Default: ${read_otp_dc}):" 0 0)
|
||||
if [ ! -z "${name_otp}" ] ; then
|
||||
name_otp=$(spaceForDot "${name_otp}")
|
||||
name_otp=$(vault_key_encrypt "${name_otp}")
|
||||
otp_text=$(vault_key_encrypt "OTP")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/otp"
|
||||
@ -843,6 +921,7 @@ function edit_entry_vault() {
|
||||
read_card_dc=$(vault_key_decrypt "${read_card}")
|
||||
name_card=$(dialog --stdout --title "# Selected Entry ${vault_edit_entry} $(generate_spaces 40)" --inputbox "# Enter Card Number (Default: ${read_card_dc}):" 0 0)
|
||||
if [ ! -z "${name_card}" ] ; then
|
||||
name_card=$(spaceForDot "${name_card}")
|
||||
name_card=$(vault_key_encrypt "${name_card}")
|
||||
card_text=$(vault_key_encrypt "Card")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/card"
|
||||
@ -854,6 +933,7 @@ function edit_entry_vault() {
|
||||
read_expiry_dc=$(vault_key_decrypt "${read_expiry}")
|
||||
name_expiry=$(dialog --stdout --title "# Selected Entry ${vault_edit_entry} $(generate_spaces 20)" --inputbox "# Enter Expiry Date (Default: ${read_expiry_dc}):" 0 0)
|
||||
if [ ! -z "${name_expiry}" ] ; then
|
||||
name_expiry=$(spaceForDot "${name_expiry}")
|
||||
name_expiry=$(vault_key_encrypt "${name_expiry}")
|
||||
expiry_text=$(vault_key_encrypt "Expiry")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/expiry"
|
||||
@ -865,6 +945,7 @@ function edit_entry_vault() {
|
||||
read_cvv_dc=$(vault_key_decrypt "${read_cvv}")
|
||||
name_cvv=$(dialog --stdout --title "# Selected Entry ${vault_edit_entry} $(generate_spaces 20)" --inputbox "# Enter CVV (Default: ${read_cvv_dc}):" 0 0)
|
||||
if [ ! -z "${name_cvv}" ] ; then
|
||||
name_cvv=$(spaceForDot "${name_cvv}")
|
||||
name_cvv=$(vault_key_encrypt "${name_cvv}")
|
||||
cvv_text=$(vault_key_encrypt "cvv")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/cvv"
|
||||
@ -894,7 +975,8 @@ function edit_entry_vault() {
|
||||
}
|
||||
|
||||
function search_entries_vault() {
|
||||
clear
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Loading Search List Entries \\" 0 0
|
||||
cd ${pwsh_vault}
|
||||
rm -rf ${pwsh_vault_cache_logins}
|
||||
rm -rf ${pwsh_vault_cache_logins_otp}
|
||||
@ -929,8 +1011,9 @@ function search_entries_vault() {
|
||||
0 0 0 l "Search Login/Website Entry" o "Search Login/Website Entry (Show OTP)" \
|
||||
b "Search Credit/Bank Card Entry" n "Search Note Entry" r "Back")
|
||||
if [ "${search_entry}" == "l" ] ; then
|
||||
echo ""
|
||||
string_search=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 40)" --inputbox "# Type a string to search:" 0 0)
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Applying Search Filter To Entries \\" 0 0
|
||||
if [ -z "${string_search}" ] ; then
|
||||
rm -rf ${pwsh_vault_cache_temp}
|
||||
touch ${pwsh_vault_cache_temp}
|
||||
@ -952,6 +1035,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1014,6 +1099,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1058,6 +1145,8 @@ function search_entries_vault() {
|
||||
fi
|
||||
elif [ "${search_entry}" == "o" ] ; then
|
||||
string_search=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 40)" --inputbox "# Type a string to search:" 0 0)
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Applying Search Filter To Entries \\" 0 0
|
||||
if [ -z "${string_search}" ] ; then
|
||||
rm -rf ${pwsh_vault_cache_temp}
|
||||
touch ${pwsh_vault_cache_temp}
|
||||
@ -1080,6 +1169,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1139,6 +1230,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1179,6 +1272,8 @@ function search_entries_vault() {
|
||||
fi
|
||||
elif [ "${search_entry}" == "b" ] ; then
|
||||
string_search=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 40)" --inputbox "# Type a string to search:" 0 0)
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Applying Search Filter To Entries \\" 0 0
|
||||
if [ -z "${string_search}" ] ; then
|
||||
rm -rf ${pwsh_vault_cache_temp}
|
||||
touch ${pwsh_vault_cache_temp}
|
||||
@ -1200,6 +1295,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1257,6 +1354,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1296,6 +1395,8 @@ function search_entries_vault() {
|
||||
fi
|
||||
elif [ "${search_entry}" == "n" ] ; then
|
||||
string_search=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 40)" --inputbox "# Type a string to search:" 0 0)
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Applying Search Filter To Entries \\" 0 0
|
||||
if [ -z "${string_search}" ] ; then
|
||||
rm -rf ${pwsh_vault_cache_temp}
|
||||
touch ${pwsh_vault_cache_temp}
|
||||
@ -1317,6 +1418,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1363,6 +1466,8 @@ function search_entries_vault() {
|
||||
if [ -z "${search_show_entry}" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo > /dev/null | dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
|
||||
--progressbox "# Decrypting Entry Number ${search_show_entry} \\" 0 0
|
||||
expr ${search_show_entry} + 1 &> /dev/null
|
||||
error=$?
|
||||
if [ ${error} -eq 0 ] ; then
|
||||
@ -1406,7 +1511,6 @@ function reset_config() {
|
||||
function pwsh_vault_main() {
|
||||
vault_main_init=0
|
||||
while [ ${vault_main_init} -eq 0 ] ;do
|
||||
clear
|
||||
vault_main_option=$(dialog --stdout --menu "# pwsh-vault-dl ${VERSION}" \
|
||||
0 0 0 c "Create Entry" e "Edit Entry" s "Search Entry" l "List Entry" \
|
||||
r "Remove Entry" m "Change MasterKey" g "Generate Password" x "Export Vault" \
|
||||
|
107
pwsh-vault.sh
107
pwsh-vault.sh
@ -5,9 +5,9 @@
|
||||
# Author: q3aql #
|
||||
# Contact: q3aql@duck.com #
|
||||
# License: GPL v2.0 #
|
||||
# Last-Change: 24-06-20222 #
|
||||
# Last-Change: 17-07-20222 #
|
||||
# #########################################################
|
||||
VERSION="0.1"
|
||||
VERSION="0.2"
|
||||
|
||||
# Variables
|
||||
pwsh_vault="${HOME}/.pwsh-vault"
|
||||
@ -54,6 +54,28 @@ function removeSpaces() {
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function spaceForDot() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
echo "${wordToConvert}" > ${sedtmpfile}
|
||||
# Remove spaces
|
||||
sed -i 's/ /·/g' "${sedtmpfile}" &> /dev/null
|
||||
# Show file without spaces
|
||||
wordToConvert=$(cat ${sedtmpfile})
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function removeSpacesURL() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
echo "${wordToConvert}" > ${sedtmpfile}
|
||||
# Remove spaces
|
||||
sed -i 's/ /%/g' "${sedtmpfile}" &> /dev/null
|
||||
# Show file without spaces
|
||||
wordToConvert=$(cat ${sedtmpfile})
|
||||
echo ${wordToConvert}
|
||||
}
|
||||
|
||||
function restoreSpaces() {
|
||||
wordToConvert=${1}
|
||||
sedtmpfile="${file_code_sec}"
|
||||
@ -155,10 +177,20 @@ function vault_key_decrypt() {
|
||||
function generate_password() {
|
||||
if [ -z "${1}" ] ; then
|
||||
default_long_password=20
|
||||
elif [ ${1} -lt 8 ] ; then
|
||||
else
|
||||
expr ${1} + 1 &> /dev/null
|
||||
num_error=$?
|
||||
if [ ${num_error} -ne 0 ] ; then
|
||||
size_pass=20
|
||||
else
|
||||
size_pass="${1}"
|
||||
fi
|
||||
# Create password
|
||||
if [ ${size_pass} -lt 8 ] ; then
|
||||
default_long_password=10
|
||||
else
|
||||
default_long_password=${1}
|
||||
default_long_password=${size_pass}
|
||||
fi
|
||||
fi
|
||||
count_char_password=1
|
||||
current_password=""
|
||||
@ -180,12 +212,20 @@ function generate_password() {
|
||||
function generate_password_gui() {
|
||||
if [ -z "${1}" ] ; then
|
||||
default_long_password=20
|
||||
elif [ ${1} -lt 8 ] ; then
|
||||
default_long_password=10
|
||||
elif [ ${1} -gt 30 ] ; then
|
||||
default_long_password=30
|
||||
else
|
||||
default_long_password=${1}
|
||||
expr ${1} + 1 &> /dev/null
|
||||
num_error=$?
|
||||
if [ ${num_error} -ne 0 ] ; then
|
||||
size_pass=20
|
||||
else
|
||||
size_pass="${1}"
|
||||
fi
|
||||
# Create password
|
||||
if [ ${size_pass} -lt 8 ] ; then
|
||||
default_long_password=10
|
||||
else
|
||||
default_long_password=${size_pass}
|
||||
fi
|
||||
fi
|
||||
count_char_password=1
|
||||
current_password=""
|
||||
@ -242,6 +282,10 @@ function create_login_vault_entry() {
|
||||
name_entry=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter Name for Login Entry:")
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/logins/${name_entry}" ] ; then
|
||||
echo > /dev/null | pwsh-vaultm -p "爵 Vault logins/${name_entry} already exists $(generate_spaces 55)"
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/logins/${name_entry}"
|
||||
name_login_entry=1
|
||||
fi
|
||||
@ -250,6 +294,7 @@ function create_login_vault_entry() {
|
||||
while [ ${username_entry} -eq 0 ] ; do
|
||||
name_username=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter Username:")
|
||||
if [ ! -z "${name_username}" ] ; then
|
||||
name_username=$(spaceForDot "${name_username}")
|
||||
name_username=$(vault_key_encrypt "${name_username}")
|
||||
username_text=$(vault_key_encrypt "Username")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/login"
|
||||
@ -261,6 +306,7 @@ function create_login_vault_entry() {
|
||||
while [ ${password_entry} -eq 0 ] ; do
|
||||
name_password=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter Password:")
|
||||
if [ ! -z "${name_password}" ] ; then
|
||||
name_password=$(spaceForDot "${name_password}")
|
||||
name_password=$(vault_key_encrypt "${name_password}")
|
||||
password_text=$(vault_key_encrypt "Password")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/password"
|
||||
@ -272,6 +318,7 @@ function create_login_vault_entry() {
|
||||
while [ ${url_entry} -eq 0 ] ; do
|
||||
name_url=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter URL:")
|
||||
if [ ! -z "${name_url}" ] ; then
|
||||
name_url=$(removeSpacesURL "${name_url}")
|
||||
name_url=$(vault_key_encrypt "${name_url}")
|
||||
url_text=$(vault_key_encrypt "URL")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/url"
|
||||
@ -283,6 +330,7 @@ function create_login_vault_entry() {
|
||||
while [ ${otp_entry} -eq 0 ] ; do
|
||||
name_otp=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter OTP (Default: None):")
|
||||
if [ ! -z "${name_otp}" ] ; then
|
||||
name_otp=$(spaceForDot "${name_otp}")
|
||||
name_otp=$(vault_key_encrypt "${name_otp}")
|
||||
otp_text=$(vault_key_encrypt "OTP")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/logins/${name_entry}/otp"
|
||||
@ -308,6 +356,10 @@ function create_bcard_vault_entry() {
|
||||
name_entry=$(echo > /dev/null | pwsh-vaultm -p " Enter Name for Bcard Entry:")
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/bcard/${name_entry}" ] ; then
|
||||
echo > /dev/null | pwsh-vaultm -p " Vault bcard/${name_entry} already exists $(generate_spaces 55)"
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/bcard/${name_entry}"
|
||||
name_bcard_entry=1
|
||||
fi
|
||||
@ -328,6 +380,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${card_entry} -eq 0 ] ; do
|
||||
name_card=$(echo > /dev/null | pwsh-vaultm -p " Enter Card Number (XXXX-XXXX-XXXX-XXXX):")
|
||||
if [ ! -z "${name_card}" ] ; then
|
||||
name_card=$(spaceForDot "${name_card}")
|
||||
name_card=$(vault_key_encrypt "${name_card}")
|
||||
card_text=$(vault_key_encrypt "Card")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/card"
|
||||
@ -339,6 +392,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${expiry_entry} -eq 0 ] ; do
|
||||
name_expiry=$(echo > /dev/null | pwsh-vaultm -p " Enter Expiry Date (MM/YY):")
|
||||
if [ ! -z "${name_expiry}" ] ; then
|
||||
name_expiry=$(spaceForDot "${name_expiry}")
|
||||
name_expiry=$(vault_key_encrypt "${name_expiry}")
|
||||
expiry_text=$(vault_key_encrypt "Expiry")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/expiry"
|
||||
@ -350,6 +404,7 @@ function create_bcard_vault_entry() {
|
||||
while [ ${cvv_entry} -eq 0 ] ; do
|
||||
name_cvv=$(echo > /dev/null | pwsh-vaultm -p " Enter CVV:")
|
||||
if [ ! -z "${name_cvv}" ] ; then
|
||||
name_cvv=$(spaceForDot "${name_cvv}")
|
||||
name_cvv=$(vault_key_encrypt "${name_cvv}")
|
||||
cvv_text=$(vault_key_encrypt "CVV")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/bcard/${name_entry}/cvv"
|
||||
@ -368,6 +423,10 @@ function create_note_vault_entry() {
|
||||
name_entry=$(echo > /dev/null | pwsh-vaultm -p " Enter Name for Note Entry:")
|
||||
if [ ! -z "${name_entry}" ] ; then
|
||||
name_entry=$(removeSpaces "${name_entry}")
|
||||
if [ -d "${pwsh_vault}/notes/${name_entry}" ] ; then
|
||||
echo > /dev/null | pwsh-vaultm -p " Vault notes/${name_entry} already exists $(generate_spaces 55)"
|
||||
pwsh_vault_main
|
||||
fi
|
||||
mkdir -p "${pwsh_vault}/notes/${name_entry}"
|
||||
name_note_entry=1
|
||||
fi
|
||||
@ -837,6 +896,7 @@ function edit_entry_vault() {
|
||||
read_userame_dc=$(vault_key_decrypt "${read_username}")
|
||||
name_username=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter Username (Default: ${read_userame_dc}):")
|
||||
if [ ! -z "${name_username}" ] ; then
|
||||
name_username=$(spaceForDot "${name_username}")
|
||||
name_username=$(vault_key_encrypt "${name_username}")
|
||||
username_text=$(vault_key_encrypt "Username")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/login"
|
||||
@ -848,6 +908,7 @@ function edit_entry_vault() {
|
||||
read_password_dc=$(vault_key_decrypt "${read_password}")
|
||||
name_password=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter Password (Default: ${read_password_dc}):")
|
||||
if [ ! -z "${name_password}" ] ; then
|
||||
name_password=$(spaceForDot "${name_password}")
|
||||
name_password=$(vault_key_encrypt "${name_password}")
|
||||
password_text=$(vault_key_encrypt "Password")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/password"
|
||||
@ -859,6 +920,7 @@ function edit_entry_vault() {
|
||||
read_url_dc=$(vault_key_decrypt "${read_url}")
|
||||
name_url=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter URL (Default: ${read_url_dc}):")
|
||||
if [ ! -z "${name_url}" ] ; then
|
||||
name_url=$(removeSpacesURL "${name_url}")
|
||||
name_url=$(vault_key_encrypt "${name_url}")
|
||||
url_text=$(vault_key_encrypt "URL")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/url"
|
||||
@ -870,6 +932,7 @@ function edit_entry_vault() {
|
||||
read_otp_dc=$(vault_key_decrypt "${read_otp}")
|
||||
name_otp=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter OTP (Default: None):")
|
||||
if [ ! -z "${name_otp}" ] ; then
|
||||
name_otp=$(spaceForDot "${name_otp}")
|
||||
name_otp=$(vault_key_encrypt "${name_otp}")
|
||||
otp_text=$(vault_key_encrypt "OTP")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/otp"
|
||||
@ -894,6 +957,7 @@ function edit_entry_vault() {
|
||||
read_card_dc=$(vault_key_decrypt "${read_card}")
|
||||
name_card=$(echo > /dev/null | pwsh-vaultm -p " Enter Card Number (Default: ${read_card_dc}):")
|
||||
if [ ! -z "${name_card}" ] ; then
|
||||
name_card=$(spaceForDot "${name_card}")
|
||||
name_card=$(vault_key_encrypt "${name_card}")
|
||||
card_text=$(vault_key_encrypt "Card")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/card"
|
||||
@ -905,6 +969,7 @@ function edit_entry_vault() {
|
||||
read_expiry_dc=$(vault_key_decrypt "${read_expiry}")
|
||||
name_expiry=$(echo > /dev/null | pwsh-vaultm -p " Enter Expiry Date (Default: ${read_expiry_dc}):")
|
||||
if [ ! -z "${name_expiry}" ] ; then
|
||||
name_expiry=$(spaceForDot "${name_expiry}")
|
||||
name_expiry=$(vault_key_encrypt "${name_expiry}")
|
||||
expiry_text=$(vault_key_encrypt "Expiry")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/expiry"
|
||||
@ -916,6 +981,7 @@ function edit_entry_vault() {
|
||||
read_cvv_dc=$(vault_key_decrypt "${read_cvv}")
|
||||
name_cvv=$(echo > /dev/null | pwsh-vaultm -p " Enter CVV (Default: ${read_cvv_dc}):")
|
||||
if [ ! -z "${name_cvv}" ] ; then
|
||||
name_cvv=$(spaceForDot "${name_cvv}")
|
||||
name_cvv=$(vault_key_encrypt "${name_cvv}")
|
||||
cvv_text=$(vault_key_encrypt "cvv")
|
||||
echo "${masterkey_load}" > "${pwsh_vault}/${vault_edit_entry}/cvv"
|
||||
@ -1263,6 +1329,28 @@ function pwsh_vault_main() {
|
||||
done
|
||||
}
|
||||
|
||||
function check_output_display() {
|
||||
if [ -f /usr/bin/pwsh-vaultm ] ; then
|
||||
display=0
|
||||
if [ -z "${XDG_SESSION_TYPE}" ] ; then
|
||||
display=1
|
||||
elif [ "${XDG_SESSION_TYPE}" == "tty" ] ; then
|
||||
display=1
|
||||
elif [ "${XDG_SESSION_TYPE}" == "x11" ] ; then
|
||||
display=0
|
||||
elif [ "${XDG_SESSION_TYPE}" == "wayland" ] ; then
|
||||
display=0
|
||||
fi
|
||||
if [ "${display}" == "1" ] ; then
|
||||
pwsh-vault-dl
|
||||
exit
|
||||
fi
|
||||
else
|
||||
pwsh-vault-dl
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# Create directories & run script
|
||||
mkdir -p ${pwsh_vault}
|
||||
mkdir -p ${pwsh_vault}/notes
|
||||
@ -1295,6 +1383,7 @@ elif [ "${1}" == "--gen-password" ] ; then
|
||||
generate_password "${2}" "param"
|
||||
fi
|
||||
else
|
||||
check_output_display
|
||||
init_masterkey
|
||||
pwsh_vault_main
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user