Fix password generation with empty value

This commit is contained in:
q3aql 2022-07-17 14:11:49 +02:00
parent 4e23de6712
commit 69983554a7
3 changed files with 68 additions and 68 deletions

View File

@ -5,7 +5,7 @@
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
# License: GPL v2.0 # # License: GPL v2.0 #
# Last-Change: 01-07-20222 # # Last-Change: 17-07-20222 #
# ########################################################### # ###########################################################
VERSION="0.2" VERSION="0.2"
@ -145,21 +145,21 @@ function generate_password() {
else else
default_long_password=${size_pass} default_long_password=${size_pass}
fi fi
count_char_password=1 fi
current_password="" count_char_password=1
echo "" current_password=""
echo "# Generating Random Password" echo ""
while [ ${count_char_password} -le ${default_long_password} ] ; do echo "# Generating Random Password"
current_char=$(generate_codes "password") while [ ${count_char_password} -le ${default_long_password} ] ; do
current_password="${current_password}${current_char}" current_char=$(generate_codes "password")
count_char_password=$(expr ${count_char_password} + 1) current_password="${current_password}${current_char}"
done count_char_password=$(expr ${count_char_password} + 1)
echo "" done
echo "# PASSWORD: ${current_password}" echo ""
echo "" echo "# PASSWORD: ${current_password}"
if [ "${2}" != "param" ] ; then echo ""
echo -n "# Press enter key to continue " ; read enter_continue if [ "${2}" != "param" ] ; then
fi echo -n "# Press enter key to continue " ; read enter_continue
fi fi
} }

View File

@ -5,7 +5,7 @@
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
# License: GPL v2.0 # # License: GPL v2.0 #
# Last-Change: 01-07-20222 # # Last-Change: 17-07-20222 #
# ############################################################# # #############################################################
VERSION="0.2" VERSION="0.2"
@ -156,21 +156,21 @@ function generate_password() {
else else
default_long_password=${size_pass} default_long_password=${size_pass}
fi fi
count_char_password=1 fi
current_password="" count_char_password=1
echo "" current_password=""
echo "# Generating Random Password" echo ""
while [ ${count_char_password} -le ${default_long_password} ] ; do echo "# Generating Random Password"
current_char=$(generate_codes "password") while [ ${count_char_password} -le ${default_long_password} ] ; do
current_password="${current_password}${current_char}" current_char=$(generate_codes "password")
count_char_password=$(expr ${count_char_password} + 1) current_password="${current_password}${current_char}"
done count_char_password=$(expr ${count_char_password} + 1)
echo "" done
echo "# PASSWORD: ${current_password}" echo ""
echo "" echo "# PASSWORD: ${current_password}"
if [ "${2}" != "param" ] ; then echo ""
echo -n "# Press enter key to continue " ; read enter_continue if [ "${2}" != "param" ] ; then
fi echo -n "# Press enter key to continue " ; read enter_continue
fi fi
} }
@ -191,15 +191,15 @@ function gen_password_dl() {
else else
default_long_password=${size_pass} default_long_password=${size_pass}
fi fi
count_char_password=1
current_password=""
while [ ${count_char_password} -le ${default_long_password} ] ; do
current_char=$(generate_codes "password")
current_password="${current_password}${current_char}"
count_char_password=$(expr ${count_char_password} + 1)
done
echo "${current_password}"
fi fi
count_char_password=1
current_password=""
while [ ${count_char_password} -le ${default_long_password} ] ; do
current_char=$(generate_codes "password")
current_password="${current_password}${current_char}"
count_char_password=$(expr ${count_char_password} + 1)
done
echo "${current_password}"
} }
function generate_password_menu() { function generate_password_menu() {

View File

@ -5,7 +5,7 @@
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
# License: GPL v2.0 # # License: GPL v2.0 #
# Last-Change: 01-07-20222 # # Last-Change: 17-07-20222 #
# ######################################################### # #########################################################
VERSION="0.2" VERSION="0.2"
@ -191,21 +191,21 @@ function generate_password() {
else else
default_long_password=${size_pass} default_long_password=${size_pass}
fi fi
count_char_password=1 fi
current_password="" count_char_password=1
echo "" current_password=""
echo "# Generating Random Password" echo ""
while [ ${count_char_password} -le ${default_long_password} ] ; do echo "# Generating Random Password"
current_char=$(generate_codes "password") while [ ${count_char_password} -le ${default_long_password} ] ; do
current_password="${current_password}${current_char}" current_char=$(generate_codes "password")
count_char_password=$(expr ${count_char_password} + 1) current_password="${current_password}${current_char}"
done count_char_password=$(expr ${count_char_password} + 1)
echo "" done
echo "# PASSWORD: ${current_password}" echo ""
echo "" echo "# PASSWORD: ${current_password}"
if [ "${2}" != "param" ] ; then echo ""
echo -n "# Press enter key to continue " ; read enter_continue if [ "${2}" != "param" ] ; then
fi echo -n "# Press enter key to continue " ; read enter_continue
fi fi
} }
@ -226,19 +226,19 @@ function generate_password_gui() {
else else
default_long_password=${size_pass} default_long_password=${size_pass}
fi fi
count_char_password=1
current_password=""
echo ""
echo "# Generating Random Password"
while [ ${count_char_password} -le ${default_long_password} ] ; do
current_char=$(generate_codes "password")
current_password="${current_password}${current_char}"
count_char_password=$(expr ${count_char_password} + 1)
done
echo ${current_password} >> ${pwsh_vault_password_copy}
echo > /dev/null | pwsh-vaultm -p " PASSWORD: ${current_password} $(generate_spaces 65)"
echo > /dev/null | pwsh-vaultm -p " Password has been copied to ${pwsh_vault_password_copy} $(generate_spaces 20)"
fi fi
count_char_password=1
current_password=""
echo ""
echo "# Generating Random Password"
while [ ${count_char_password} -le ${default_long_password} ] ; do
current_char=$(generate_codes "password")
current_password="${current_password}${current_char}"
count_char_password=$(expr ${count_char_password} + 1)
done
echo ${current_password} >> ${pwsh_vault_password_copy}
echo > /dev/null | pwsh-vaultm -p " PASSWORD: ${current_password} $(generate_spaces 65)"
echo > /dev/null | pwsh-vaultm -p " Password has been copied to ${pwsh_vault_password_copy} $(generate_spaces 20)"
} }
function generate_password_menu() { function generate_password_menu() {