Optimize list & search entries (pwsh-vault)
This commit is contained in:
parent
fd8f6229d2
commit
a0ca6782af
576
pwsh-vault.sh
576
pwsh-vault.sh
|
@ -561,270 +561,221 @@ function pwsh_vault_help() {
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function size_extracted_vault_logins() {
|
||||||
|
param_s="${1}"
|
||||||
|
name_length=1
|
||||||
|
name_count=1
|
||||||
|
if [ -z "${param_s}" ] ; then
|
||||||
|
ls -1 ${pwsh_vault}/logins | while read entry ; do
|
||||||
|
name_count=$(echo "logins/${entry}" | wc -m)
|
||||||
|
# Compare the maximum size of the variables
|
||||||
|
if [ ${name_count} -gt ${name_length} ] ; then
|
||||||
|
name_length=${name_count}
|
||||||
|
echo ${name_length}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ls -1 ${pwsh_vault}/logins | grep -i "${param_s}" | while read entry ; do
|
||||||
|
name_count=$(echo "logins/${entry}" | wc -m)
|
||||||
|
# Compare the maximum size of the variables
|
||||||
|
if [ ${name_count} -gt ${name_length} ] ; then
|
||||||
|
name_length=${name_count}
|
||||||
|
echo ${name_length}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function size_extracted_vault_bcard() {
|
||||||
|
param_s="${1}"
|
||||||
|
name_length=1
|
||||||
|
name_count=1
|
||||||
|
if [ -z "${param_s}" ] ; then
|
||||||
|
ls -1 ${pwsh_vault}/bcard | while read entry ; do
|
||||||
|
name_count=$(echo "bcard/${entry}" | wc -m)
|
||||||
|
# Compare the maximum size of the variables
|
||||||
|
if [ ${name_count} -gt ${name_length} ] ; then
|
||||||
|
name_length=${name_count}
|
||||||
|
echo ${name_length}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ls -1 ${pwsh_vault}/bcard | grep -i "${param_s}" | while read entry ; do
|
||||||
|
name_count=$(echo "logins/${entry}" | wc -m)
|
||||||
|
# Compare the maximum size of the variables
|
||||||
|
if [ ${name_count} -gt ${name_length} ] ; then
|
||||||
|
name_length=${name_count}
|
||||||
|
echo ${name_length}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function size_extracted_vault_notes() {
|
||||||
|
param_s="${1}"
|
||||||
|
name_length=1
|
||||||
|
name_count=1
|
||||||
|
if [ -z "${param_s}" ] ; then
|
||||||
|
ls -1 ${pwsh_vault}/notes | while read entry ; do
|
||||||
|
name_count=$(echo "notes/${entry}" | wc -m)
|
||||||
|
# Compare the maximum size of the variables
|
||||||
|
if [ ${name_count} -gt ${name_length} ] ; then
|
||||||
|
name_length=${name_count}
|
||||||
|
echo ${name_length}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ls -1 ${pwsh_vault}/notes | grep -i "${param_s}" | while read entry ; do
|
||||||
|
name_count=$(echo "logins/${entry}" | wc -m)
|
||||||
|
# Compare the maximum size of the variables
|
||||||
|
if [ ${name_count} -gt ${name_length} ] ; then
|
||||||
|
name_length=${name_count}
|
||||||
|
echo ${name_length}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function process_extracted_vault_logins() {
|
function process_extracted_vault_logins() {
|
||||||
vault_cache_length=$(cat ${pwsh_vault_cache_logins} | wc -l)
|
param="${1}"
|
||||||
|
if [ -z "${param}" ] ; then
|
||||||
|
name_length=$(size_extracted_vault_logins | tail -1)
|
||||||
|
else
|
||||||
|
name_length=$(size_extracted_vault_logins "${param}" | tail -1)
|
||||||
|
fi
|
||||||
|
login_length="11"
|
||||||
|
password_length="18"
|
||||||
|
url_length="10"
|
||||||
|
otp_length="10"
|
||||||
count_length=1
|
count_length=1
|
||||||
# Count the width of all cells
|
row_length=$(expr ${name_length} + ${login_length} + ${password_length} + ${url_length} + ${otp_length} + 10)
|
||||||
name_length=9
|
|
||||||
login_length=5
|
|
||||||
password_length=8
|
|
||||||
url_length=3
|
|
||||||
otp_length=3
|
|
||||||
while [ ${count_length} -le ${vault_cache_length} ] ; do
|
|
||||||
name_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 1 | wc -m)
|
|
||||||
login_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 2 | wc -m)
|
|
||||||
password_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 3 | wc -m)
|
|
||||||
url_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 4 | wc -m)
|
|
||||||
otp_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 5 | wc -m)
|
|
||||||
# Compare the maximum size of the variables
|
|
||||||
if [ ${name_count} -gt ${name_length} ] ; then
|
|
||||||
name_length=${name_count}
|
|
||||||
fi
|
|
||||||
if [ ${login_count} -gt ${login_length} ] ; then
|
|
||||||
login_length=${login_count}
|
|
||||||
fi
|
|
||||||
if [ ${password_count} -gt ${password_length} ] ; then
|
|
||||||
password_length=${password_count}
|
|
||||||
fi
|
|
||||||
if [ ${url_count} -gt ${url_length} ] ; then
|
|
||||||
url_length=${url_count}
|
|
||||||
fi
|
|
||||||
if [ ${otp_count} -gt ${otp_length} ] ; then
|
|
||||||
otp_length=${otp_count}
|
|
||||||
fi
|
|
||||||
count_length=$(expr ${count_length} + 1)
|
|
||||||
done
|
|
||||||
count_length=1
|
|
||||||
row_length=$(expr ${name_length} + ${login_length} + ${password_length} + ${url_length} + ${otp_length} + 23)
|
|
||||||
row_length_show=1
|
row_length_show=1
|
||||||
# Display data in rows
|
if [ -z "${param}" ] ; then
|
||||||
count_length=1
|
ls -1 ${pwsh_vault}/logins | while read entry ; do
|
||||||
show_bar=0
|
name="${entry}"
|
||||||
while [ ${count_length} -le ${vault_cache_length} ] ; do
|
login="Hidden User"
|
||||||
# Read the value
|
password="Encrypted Password"
|
||||||
name=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 1)
|
url="Hidden URL"
|
||||||
login=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 2)
|
otp="Hidden OTP"
|
||||||
password=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 3)
|
name_count=$(echo "logins/${entry}" | wc -m)
|
||||||
url=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 4)
|
name_count=$(expr ${name_length} - ${name_count})
|
||||||
otp=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 5)
|
echo -n " logins/${name}"
|
||||||
# Counting the letters
|
name_max=1
|
||||||
name_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 1 | wc -m)
|
while [ ${name_max} -le ${name_count} ] ; do
|
||||||
login_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 2 | wc -m)
|
echo -n " "
|
||||||
password_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 3 | wc -m)
|
name_max=$(expr ${name_max} + 1)
|
||||||
url_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 4 | wc -m)
|
done
|
||||||
otp_count=$(cat ${pwsh_vault_cache_logins} | head -${count_length} | tail -1 | cut -d "," -f 5 | wc -m)
|
echo " - ${login} - ${password} - 爵 ${url} - 勒 ${otp}"
|
||||||
# Calculate the spaces in each row separately
|
|
||||||
name_count=$(expr ${name_length} - ${name_count})
|
|
||||||
login_count=$(expr ${login_length} - ${login_count})
|
|
||||||
password_count=$(expr ${password_length} - ${password_count})
|
|
||||||
url_count=$(expr ${url_length} - ${url_count})
|
|
||||||
otp_count=$(expr ${otp_length} - ${otp_count})
|
|
||||||
# Show each row separately
|
|
||||||
echo -n " ${name}"
|
|
||||||
name_max=1
|
|
||||||
while [ ${name_max} -le ${name_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
name_max=$(expr ${name_max} + 1)
|
|
||||||
done
|
done
|
||||||
echo -n " - "
|
else
|
||||||
echo -n " ${login}"
|
ls -1 ${pwsh_vault}/logins | grep -i "${param}" | while read entry ; do
|
||||||
login_max=1
|
name="${entry}"
|
||||||
while [ ${login_max} -le ${login_count} ] ; do
|
login="Hidden User"
|
||||||
echo -n " "
|
password="Encrypted Password"
|
||||||
login_max=$(expr ${login_max} + 1)
|
url="Hidden URL"
|
||||||
|
otp="Hidden OTP"
|
||||||
|
name_count=$(echo "logins/${entry}" | wc -m)
|
||||||
|
name_count=$(expr ${name_length} - ${name_count})
|
||||||
|
echo -n " logins/${name}"
|
||||||
|
name_max=1
|
||||||
|
while [ ${name_max} -le ${name_count} ] ; do
|
||||||
|
echo -n " "
|
||||||
|
name_max=$(expr ${name_max} + 1)
|
||||||
|
done
|
||||||
|
echo " - ${login} - ${password} - 爵 ${url} - 勒 ${otp}"
|
||||||
done
|
done
|
||||||
echo -n " - "
|
fi
|
||||||
echo -n " ${password}"
|
|
||||||
password_max=1
|
|
||||||
while [ ${password_max} -le ${password_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
password_max=$(expr ${password_max} + 1)
|
|
||||||
done
|
|
||||||
echo -n " - "
|
|
||||||
echo -n "爵 ${url}"
|
|
||||||
url_max=1
|
|
||||||
while [ ${url_max} -le ${url_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
url_max=$(expr ${url_max} + 1)
|
|
||||||
done
|
|
||||||
echo -n " - "
|
|
||||||
echo -n "勒 ${otp}"
|
|
||||||
otp_max=1
|
|
||||||
while [ ${otp_max} -le ${otp_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
otp_max=$(expr ${otp_max} + 1)
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
count_length=$(expr ${count_length} + 1)
|
|
||||||
if [ ${show_bar} -eq 0 ] ; then
|
|
||||||
row_length=$(expr ${name_length} + ${login_length} + ${password_length} + ${url_length} + ${otp_length} + 23)
|
|
||||||
row_length_show=1
|
|
||||||
show_bar=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_extracted_vault_bcard() {
|
function process_extracted_vault_bcard() {
|
||||||
vault_cache_length=$(cat ${pwsh_vault_cache_bcard} | wc -l)
|
param="${1}"
|
||||||
count_length=1
|
if [ -z "${param}" ] ; then
|
||||||
# Count the width of all cells
|
name_length=$(size_extracted_vault_bcard | tail -1)
|
||||||
name_length=9
|
else
|
||||||
owner_length=5
|
name_length=$(size_extracted_vault_bcard "${param}" | tail -1)
|
||||||
card_length=8
|
fi
|
||||||
expiry_length=3
|
owner_length="12"
|
||||||
cvv_length=3
|
card_length="11"
|
||||||
while [ ${count_length} -le ${vault_cache_length} ] ; do
|
expiry_length="13"
|
||||||
name_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 1 | wc -m)
|
cvv_length="13"
|
||||||
owner_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 2 | wc -m)
|
row_length=$(expr ${name_length} + ${owner_length} + ${card_length} + ${expiry_length} + ${cvv_length} + 10)
|
||||||
card_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 3 | wc -m)
|
|
||||||
expiry_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 4 | wc -m)
|
|
||||||
cvv_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 5 | wc -m)
|
|
||||||
# Compare the maximum size of the variables
|
|
||||||
if [ ${name_count} -gt ${name_length} ] ; then
|
|
||||||
name_length=${name_count}
|
|
||||||
fi
|
|
||||||
if [ ${owner_count} -gt ${owner_length} ] ; then
|
|
||||||
owner_length=${owner_count}
|
|
||||||
fi
|
|
||||||
if [ ${card_count} -gt ${card_length} ] ; then
|
|
||||||
card_length=${card_count}
|
|
||||||
fi
|
|
||||||
if [ ${expiry_count} -gt ${expiry_length} ] ; then
|
|
||||||
expiry_length=${expiry_count}
|
|
||||||
fi
|
|
||||||
if [ ${cvv_count} -gt ${cvv_length} ] ; then
|
|
||||||
cvv_length=${cvv_count}
|
|
||||||
fi
|
|
||||||
count_length=$(expr ${count_length} + 1)
|
|
||||||
done
|
|
||||||
count_length=1
|
|
||||||
row_length=$(expr ${name_length} + ${owner_length} + ${card_length} + ${expiry_length} + ${cvv_length} + 23)
|
|
||||||
row_length_show=1
|
row_length_show=1
|
||||||
# Display data in rows
|
if [ -z "${param}" ] ; then
|
||||||
count_length=1
|
ls -1 ${pwsh_vault}/bcard | while read entry ; do
|
||||||
show_bar=0
|
name="${entry}"
|
||||||
while [ ${count_length} -le ${vault_cache_length} ] ; do
|
owner="Hidden Owner"
|
||||||
# Read the value
|
card="Hidden Card"
|
||||||
name=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 1)
|
expiry="Hidden Expiry"
|
||||||
owner=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 2)
|
cvv="Encrypted CVV"
|
||||||
card=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 3)
|
name_count=$(echo "bcard/${entry}" | wc -m)
|
||||||
expiry=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 4)
|
name_count=$(expr ${name_length} - ${name_count})
|
||||||
cvv=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 5)
|
echo -n " bcard/${name}"
|
||||||
# Counting the letters
|
name_max=1
|
||||||
name_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 1 | wc -m)
|
while [ ${name_max} -le ${name_count} ] ; do
|
||||||
owner_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 2 | wc -m)
|
echo -n " "
|
||||||
card_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 3 | wc -m)
|
name_max=$(expr ${name_max} + 1)
|
||||||
expiry_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 4 | wc -m)
|
done
|
||||||
cvv_count=$(cat ${pwsh_vault_cache_bcard} | head -${count_length} | tail -1 | cut -d "," -f 5 | wc -m)
|
echo " - ${owner} - ${card} - ${expiry} - 况 ${cvv}"
|
||||||
# Calculate the spaces in each row separately
|
|
||||||
name_count=$(expr ${name_length} - ${name_count})
|
|
||||||
owner_count=$(expr ${owner_length} - ${owner_count})
|
|
||||||
card_count=$(expr ${card_length} - ${card_count})
|
|
||||||
expiry_count=$(expr ${expiry_length} - ${expiry_count})
|
|
||||||
cvv_count=$(expr ${cvv_length} - ${cvv_count})
|
|
||||||
# Show each row separately
|
|
||||||
echo -n " ${name}"
|
|
||||||
name_max=1
|
|
||||||
while [ ${name_max} -le ${name_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
name_max=$(expr ${name_max} + 1)
|
|
||||||
done
|
done
|
||||||
echo -n " - "
|
else
|
||||||
echo -n " ${owner}"
|
ls -1 ${pwsh_vault}/bcard | grep -i "${param}" | while read entry ; do
|
||||||
owner_max=1
|
name="${entry}"
|
||||||
while [ ${owner_max} -le ${owner_count} ] ; do
|
owner="Hidden Owner"
|
||||||
echo -n " "
|
card="Hidden Card"
|
||||||
owner_max=$(expr ${owner_max} + 1)
|
expiry="Hidden Expiry"
|
||||||
|
cvv="Encrypted CVV"
|
||||||
|
name_count=$(echo "bcard/${entry}" | wc -m)
|
||||||
|
name_count=$(expr ${name_length} - ${name_count})
|
||||||
|
echo -n " bcard/${name}"
|
||||||
|
name_max=1
|
||||||
|
while [ ${name_max} -le ${name_count} ] ; do
|
||||||
|
echo -n " "
|
||||||
|
name_max=$(expr ${name_max} + 1)
|
||||||
|
done
|
||||||
|
echo " - ${owner} - ${card} - ${expiry} - 况 ${cvv}"
|
||||||
done
|
done
|
||||||
echo -n " - "
|
fi
|
||||||
echo -n " ${card}"
|
|
||||||
card_max=1
|
|
||||||
while [ ${card_max} -le ${card_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
card_max=$(expr ${card_max} + 1)
|
|
||||||
done
|
|
||||||
echo -n " - "
|
|
||||||
echo -n " ${expiry}"
|
|
||||||
expiry_max=1
|
|
||||||
while [ ${expiry_max} -le ${expiry_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
expiry_max=$(expr ${expiry_max} + 1)
|
|
||||||
done
|
|
||||||
echo -n " - "
|
|
||||||
echo -n "况 ${cvv}"
|
|
||||||
cvv_max=1
|
|
||||||
while [ ${cvv_max} -le ${cvv_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
cvv_max=$(expr ${cvv_max} + 1)
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
count_length=$(expr ${count_length} + 1)
|
|
||||||
if [ ${show_bar} -eq 0 ] ; then
|
|
||||||
row_length=$(expr ${name_length} + ${owner_length} + ${card_length} + ${expiry_length} + ${cvv_length} + 23)
|
|
||||||
row_length_show=1
|
|
||||||
show_bar=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_extracted_vault_notes() {
|
function process_extracted_vault_notes() {
|
||||||
vault_cache_length=$(cat ${pwsh_vault_cache_notes} | wc -l)
|
param="${1}"
|
||||||
count_length=1
|
if [ -z "${param}" ] ; then
|
||||||
# Count the width of all cells
|
name_length=$(size_extracted_vault_notes | tail -1)
|
||||||
name_length=9
|
else
|
||||||
note_length=5
|
name_length=$(size_extracted_vault_notes "${param}" | tail -1)
|
||||||
while [ ${count_length} -le ${vault_cache_length} ] ; do
|
fi
|
||||||
name_count=$(cat ${pwsh_vault_cache_notes} | head -${count_length} | tail -1 | cut -d "," -f 1 | wc -m)
|
note_length="14"
|
||||||
note_count=$(cat ${pwsh_vault_cache_notes} | head -${count_length} | tail -1 | cut -d "," -f 2 | wc -m)
|
row_length=$(expr ${name_length} + ${note_length} + 4)
|
||||||
if [ ${name_count} -gt ${name_length} ] ; then
|
|
||||||
name_length=${name_count}
|
|
||||||
fi
|
|
||||||
if [ ${note_count} -gt ${note_length} ] ; then
|
|
||||||
note_length=${note_count}
|
|
||||||
fi
|
|
||||||
count_length=$(expr ${count_length} + 1)
|
|
||||||
done
|
|
||||||
count_length=1
|
|
||||||
row_length=$(expr ${name_length} + ${note_length} + 9)
|
|
||||||
row_length_show=1
|
row_length_show=1
|
||||||
# Display data in rows
|
if [ -z "${param}" ] ; then
|
||||||
count_length=1
|
ls -1 ${pwsh_vault}/notes | while read entry ; do
|
||||||
show_bar=0
|
name="${entry}"
|
||||||
while [ ${count_length} -le ${vault_cache_length} ] ; do
|
note="Encrypted Note"
|
||||||
# Read the value
|
name_count=$(echo "notes/${entry}" | wc -m)
|
||||||
name=$(cat ${pwsh_vault_cache_notes} | head -${count_length} | tail -1 | cut -d "," -f 1)
|
name_count=$(expr ${name_length} - ${name_count})
|
||||||
note=$(cat ${pwsh_vault_cache_notes} | head -${count_length} | tail -1 | cut -d "," -f 2)
|
echo -n " notes/${name}"
|
||||||
# Counting the letters
|
name_max=1
|
||||||
name_count=$(cat ${pwsh_vault_cache_notes} | head -${count_length} | tail -1 | cut -d "," -f 1 | wc -m)
|
while [ ${name_max} -le ${name_count} ] ; do
|
||||||
note_count=$(cat ${pwsh_vault_cache_notes} | head -${count_length} | tail -1 | cut -d "," -f 2 | wc -m)
|
echo -n " "
|
||||||
# Calculate the spaces in each row separately
|
name_max=$(expr ${name_max} + 1)
|
||||||
name_count=$(expr ${name_length} - ${name_count})
|
done
|
||||||
note_count=$(expr ${note_length} - ${note_count})
|
echo " - ${note}"
|
||||||
# Show each row separately
|
|
||||||
echo -n " ${name}"
|
|
||||||
name_max=1
|
|
||||||
while [ ${name_max} -le ${name_count} ] ; do
|
|
||||||
echo -n " "
|
|
||||||
name_max=$(expr ${name_max} + 1)
|
|
||||||
done
|
done
|
||||||
echo -n " - "
|
else
|
||||||
echo -n " ${note}"
|
ls -1 ${pwsh_vault}/notes | grep -i "${param}" | while read entry ; do
|
||||||
note_max=1
|
name="${entry}"
|
||||||
while [ ${note_max} -le ${note_count} ] ; do
|
note="Encrypted Note"
|
||||||
echo -n " "
|
name_count=$(echo "notes/${entry}" | wc -m)
|
||||||
note_max=$(expr ${note_max} + 1)
|
name_count=$(expr ${name_length} - ${name_count})
|
||||||
|
echo -n " notes/${name}"
|
||||||
|
name_max=1
|
||||||
|
while [ ${name_max} -le ${name_count} ] ; do
|
||||||
|
echo -n " "
|
||||||
|
name_max=$(expr ${name_max} + 1)
|
||||||
|
done
|
||||||
|
echo " - ${note}"
|
||||||
done
|
done
|
||||||
echo ""
|
fi
|
||||||
count_length=$(expr ${count_length} + 1)
|
|
||||||
if [ ${show_bar} -eq 0 ] ; then
|
|
||||||
row_length=$(expr ${name_length} + ${note_length} + 9)
|
|
||||||
row_length_show=1
|
|
||||||
show_bar=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_corrupted_entry_vault() {
|
function check_corrupted_entry_vault() {
|
||||||
|
@ -892,9 +843,11 @@ function run_all_list_process_extracted_vault() {
|
||||||
list_notes_count=$(ls -1 notes/ | wc -l)
|
list_notes_count=$(ls -1 notes/ | wc -l)
|
||||||
if [ ${list_logins_count} -ne 0 ] ; then
|
if [ ${list_logins_count} -ne 0 ] ; then
|
||||||
process_extracted_vault_logins
|
process_extracted_vault_logins
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
if [ ${list_bcard_count} -ne 0 ] ; then
|
if [ ${list_bcard_count} -ne 0 ] ; then
|
||||||
process_extracted_vault_bcard
|
process_extracted_vault_bcard
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
if [ ${list_notes_count} -ne 0 ] ; then
|
if [ ${list_notes_count} -ne 0 ] ; then
|
||||||
process_extracted_vault_notes
|
process_extracted_vault_notes
|
||||||
|
@ -912,41 +865,6 @@ function list_entries_vault() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "# Creating Vault List Entries"
|
echo "# Creating Vault List Entries"
|
||||||
echo ""
|
echo ""
|
||||||
touch ${pwsh_vault_cache_logins}
|
|
||||||
touch ${pwsh_vault_cache_bcard}
|
|
||||||
touch ${pwsh_vault_cache_notes}
|
|
||||||
list_logins_count=$(ls -1 logins/ | wc -l)
|
|
||||||
list_bcard_count=$(ls -1 bcard/ | wc -l)
|
|
||||||
list_notes_count=$(ls -1 notes/ | wc -l)
|
|
||||||
if [ ${list_logins_count} -ne 0 ] ; then
|
|
||||||
list_logins=$(ls -1 logins/)
|
|
||||||
username_show="Hidden User"
|
|
||||||
password_show="Encrypted Password"
|
|
||||||
url_show="Hidden URL"
|
|
||||||
otp_show="Hidden OTP"
|
|
||||||
for login in ${list_logins} ; do
|
|
||||||
echo "logins/${login},${username_show},${password_show},${url_show},${otp_show}" >> ${pwsh_vault_cache_logins}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
cd ${pwsh_vault}
|
|
||||||
if [ ${list_bcard_count} -ne 0 ] ; then
|
|
||||||
list_bcard=$(ls -1 bcard/)
|
|
||||||
owner_show="Hidden Owner"
|
|
||||||
num_card_show="Hidden Card"
|
|
||||||
expiry_show="Hidden Expiry"
|
|
||||||
cvv_show="Encrypted CVV"
|
|
||||||
for card in ${list_bcard} ; do
|
|
||||||
echo "bcard/${card},${owner_show},${num_card_show},${expiry_show},${cvv_show}" >> ${pwsh_vault_cache_bcard}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
cd ${pwsh_vault}
|
|
||||||
if [ ${list_notes_count} -ne 0 ] ; then
|
|
||||||
list_notes=$(ls -1 notes/)
|
|
||||||
note_show="Encrypted Note"
|
|
||||||
for note in ${list_notes} ; do
|
|
||||||
echo "notes/${note},${note_show}" >> ${pwsh_vault_cache_notes}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
run_all_list_process_extracted_vault | pwsh-vaultm -p " List Entries:"
|
run_all_list_process_extracted_vault | pwsh-vaultm -p " List Entries:"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1304,52 +1222,11 @@ function search_entries_vault() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "# Preparing Vault List Entries"
|
echo "# Preparing Vault List Entries"
|
||||||
echo ""
|
echo ""
|
||||||
rm -rf ${pwsh_vault_cache_logins}
|
|
||||||
rm -rf ${pwsh_vault_cache_logins_otp}
|
|
||||||
rm -rf ${pwsh_vault_cache_bcard}
|
|
||||||
rm -rf ${pwsh_vault_cache_notes}
|
|
||||||
list_logins_count=$(ls -1 logins/ | wc -l)
|
|
||||||
list_bcard_count=$(ls -1 bcard/ | wc -l)
|
|
||||||
list_notes_count=$(ls -1 notes/ | wc -l)
|
|
||||||
if [ ${list_logins_count} -ne 0 ] ; then
|
|
||||||
list_logins=$(ls -1 logins/)
|
|
||||||
for login in ${list_logins} ; do
|
|
||||||
username_show="Hidden User"
|
|
||||||
password_show="Encrypted Password"
|
|
||||||
url_show="Hidden URL"
|
|
||||||
otp_show="Hidden OTP"
|
|
||||||
echo "logins/${login},${username_show},${password_show},${url_show},${otp_show}" >> ${pwsh_vault_cache_logins_otp}
|
|
||||||
echo "logins/${login},${username_show},${password_show},${url_show},${otp_show}" >> ${pwsh_vault_cache_logins}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
cd ${pwsh_vault}
|
|
||||||
if [ ${list_bcard_count} -ne 0 ] ; then
|
|
||||||
list_bcard=$(ls -1 bcard/)
|
|
||||||
for card in ${list_bcard} ; do
|
|
||||||
owner_show="Hidden Owner"
|
|
||||||
num_card_show="Hidden Card"
|
|
||||||
expiry_show="Hidden Expiry"
|
|
||||||
cvv_show="Encrypted CVV"
|
|
||||||
echo "bcard/${card},${owner_show},${num_card_show},${expiry_show},${cvv_show}" >> ${pwsh_vault_cache_bcard}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
cd ${pwsh_vault}
|
|
||||||
if [ ${list_notes_count} -ne 0 ] ; then
|
|
||||||
list_notes=$(ls -1 notes/)
|
|
||||||
for note in ${list_notes} ; do
|
|
||||||
note_show="Encrypted Note"
|
|
||||||
echo "notes/${note},${note_show}" >> ${pwsh_vault_cache_notes}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
search_entry=$(search_entries_menu_show | pwsh-vaultm -p " Search Entry:")
|
search_entry=$(search_entries_menu_show | pwsh-vaultm -p " Search Entry:")
|
||||||
if [ "${search_entry}" == "爵 Search Login/Website Entry" ] ; then
|
if [ "${search_entry}" == "爵 Search Login/Website Entry" ] ; then
|
||||||
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
||||||
if [ -z "${string_search}" ] ; then
|
if [ -z "${string_search}" ] ; then
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/logins | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_logins} >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_logins}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_logins} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
|
@ -1363,15 +1240,11 @@ function search_entries_vault() {
|
||||||
rm -rf ${pwsh_vault_cache_logins}
|
rm -rf ${pwsh_vault_cache_logins}
|
||||||
search_entries_vault
|
search_entries_vault
|
||||||
else
|
else
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/logins | grep -i "${string_search}" | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_logins} | grep -i "${string_search}" >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_logins}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_logins} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
copy_clipboard=$(process_extracted_vault_logins | pwsh-vaultm -p " Search Results:")
|
copy_clipboard=$(process_extracted_vault_logins "${string_search}" | pwsh-vaultm -p " Search Results:")
|
||||||
if [ -z "${copy_clipboard}" ] ; then
|
if [ -z "${copy_clipboard}" ] ; then
|
||||||
echo "# Ignore copy clipboard"
|
echo "# Ignore copy clipboard"
|
||||||
else
|
else
|
||||||
|
@ -1384,11 +1257,7 @@ function search_entries_vault() {
|
||||||
elif [ "${search_entry}" == "爵 Search Login/Website Entry (Show OTP)" ] ; then
|
elif [ "${search_entry}" == "爵 Search Login/Website Entry (Show OTP)" ] ; then
|
||||||
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
||||||
if [ -z "${string_search}" ] ; then
|
if [ -z "${string_search}" ] ; then
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/logins | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_logins_otp} >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_logins}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_logins} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
|
@ -1402,15 +1271,11 @@ function search_entries_vault() {
|
||||||
rm -rf ${pwsh_vault_cache_logins}
|
rm -rf ${pwsh_vault_cache_logins}
|
||||||
search_entries_vault
|
search_entries_vault
|
||||||
else
|
else
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/logins | grep -i "${string_search}" | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_logins_otp} | grep -i "${string_search}" >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_logins}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_logins} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
copy_clipboard=$(process_extracted_vault_logins | pwsh-vaultm -p " Search Results:")
|
copy_clipboard=$(process_extracted_vault_logins "${string_search}" | pwsh-vaultm -p " Search Results:")
|
||||||
if [ -z "${copy_clipboard}" ] ; then
|
if [ -z "${copy_clipboard}" ] ; then
|
||||||
echo "# Ignore copy clipboard"
|
echo "# Ignore copy clipboard"
|
||||||
else
|
else
|
||||||
|
@ -1421,15 +1286,10 @@ function search_entries_vault() {
|
||||||
rm -rf ${pwsh_vault_cache_logins_otp}
|
rm -rf ${pwsh_vault_cache_logins_otp}
|
||||||
search_entries_vault
|
search_entries_vault
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "${search_entry}" == " Search Credit/Bank Card Entry" ] ; then
|
elif [ "${search_entry}" == " Search Credit/Bank Card Entry" ] ; then
|
||||||
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
||||||
if [ -z "${string_search}" ] ; then
|
if [ -z "${string_search}" ] ; then
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/bcard | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_bcard} >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_bcard}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_bcard} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
|
@ -1443,15 +1303,11 @@ function search_entries_vault() {
|
||||||
rm -rf ${pwsh_vault_cache_bcard}
|
rm -rf ${pwsh_vault_cache_bcard}
|
||||||
search_entries_vault
|
search_entries_vault
|
||||||
else
|
else
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/bcard | grep "${string_search}" | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_bcard} | grep -i "${string_search}" >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_bcard}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_bcard} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
copy_clipboard=$(process_extracted_vault_bcard | pwsh-vaultm -p " Search Results:")
|
copy_clipboard=$(process_extracted_vault_bcard "${string_search}" | pwsh-vaultm -p " Search Results:")
|
||||||
if [ -z "${copy_clipboard}" ] ; then
|
if [ -z "${copy_clipboard}" ] ; then
|
||||||
echo "# Ignore copy clipboard"
|
echo "# Ignore copy clipboard"
|
||||||
else
|
else
|
||||||
|
@ -1464,11 +1320,7 @@ function search_entries_vault() {
|
||||||
elif [ "${search_entry}" == " Search Note Entry" ] ; then
|
elif [ "${search_entry}" == " Search Note Entry" ] ; then
|
||||||
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
string_search=$(echo > /dev/null | pwsh-vaultm -p " Type a string to search:")
|
||||||
if [ -z "${string_search}" ] ; then
|
if [ -z "${string_search}" ] ; then
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/notes | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_notes} >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_notes}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_notes} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
|
@ -1482,15 +1334,11 @@ function search_entries_vault() {
|
||||||
rm -rf ${pwsh_vault_cache_notes}
|
rm -rf ${pwsh_vault_cache_notes}
|
||||||
search_entries_vault
|
search_entries_vault
|
||||||
else
|
else
|
||||||
rm -rf ${pwsh_vault_cache_temp}
|
lines_read=$(ls -1 ${pwsh_vault}/notes | grep "${string_search}" | wc -l)
|
||||||
touch ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_notes} | grep -i "${string_search}" >> ${pwsh_vault_cache_temp}
|
|
||||||
cat ${pwsh_vault_cache_temp} > ${pwsh_vault_cache_notes}
|
|
||||||
lines_read=$(cat ${pwsh_vault_cache_notes} 2> /dev/null | wc -l)
|
|
||||||
if [ ${lines_read} -eq 0 ] ; then
|
if [ ${lines_read} -eq 0 ] ; then
|
||||||
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
echo > /dev/null | pwsh-vaultm -p " No Entries to Show $(generate_spaces 70)"
|
||||||
else
|
else
|
||||||
copy_clipboard=$(process_extracted_vault_notes | pwsh-vaultm -p " Search Results:")
|
copy_clipboard=$(process_extracted_vault_notes "${string_search}" | pwsh-vaultm -p " Search Results:")
|
||||||
if [ -z "${copy_clipboard}" ] ; then
|
if [ -z "${copy_clipboard}" ] ; then
|
||||||
echo "# Ignore copy clipboard"
|
echo "# Ignore copy clipboard"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user