-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPASSWORD-STRENGTH-CHECK.sh
More file actions
39 lines (29 loc) · 944 Bytes
/
PASSWORD-STRENGTH-CHECK.sh
File metadata and controls
39 lines (29 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
echo -e "Please enter your password: \c"
read pass
readonly re_digit='[[:digit:]]'
readonly re_lower='[[:lower:]]'
readonly re_punct='[[:punct:]]'
readonly re_space='[[:space:]]'
readonly re_upper='[[:upper:]]'
for re in "$re_digit" "$re_lower" "$re_punct" "$re_upper" "8"
do
[[ ${pass} =~ $re ]] || [[ ${#pass} =~ $re ]]
done
[ $? -eq 0 ] && echo "Met all requirement" || echo "not met all the requirement"
===============================================================================================================
#!/bin/bash
echo -e "please enter password: \c"
read pass
count=`echo ${#pass}`
if [[ $count -ne 12 ]];then
echo "Password length should be 8 charactore"
exit 1;
fi
echo $pass | grep "[A-Z]" | grep "[a-z]" | grep "[0-9]" | grep "[@#$%^&*]" >> /dev/null
if [[ $? -ne 0 ]];then
echo "Password Must contain upparcase ,lowecase,number and special charactor"
exit 2;
else
echo "Password met requirement"
fi