added colors
This commit is contained in:
parent
cdb40efea8
commit
30dcee560e
@ -3,11 +3,36 @@
|
|||||||
source .env
|
source .env
|
||||||
|
|
||||||
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
||||||
|
red=`tput setaf 1`
|
||||||
|
green=`tput setaf 2`
|
||||||
|
reset=`tput sgr0`
|
||||||
|
|
||||||
curl -s -c /tmp/bmlcookie $BML_URL/login \
|
LOGIN=$(curl -s -c /tmp/bmlcookie $BML_URL/login \
|
||||||
--data-raw username=$BML_USERNAME \
|
--data-raw username=$BML_USERNAME \
|
||||||
--data-raw password=$BML_PASSWORD \
|
--data-raw password=$BML_PASSWORD \
|
||||||
--compressed > /dev/null
|
--compressed \
|
||||||
|
| awk -F 'success":' '{print $2}' \
|
||||||
|
| cut -f1 -d ',' )
|
||||||
|
|
||||||
|
if [ "$LOGIN" = "true" ]
|
||||||
|
then
|
||||||
|
NAME=$(curl -s -b /tmp/bmlcookie $BML_URL/profile \
|
||||||
|
| awk -F 'fullname":"' '{print $2}' \
|
||||||
|
| cut -f1 -d '"')
|
||||||
|
echo ""
|
||||||
|
echo ${green}Welcome ${reset}$NAME
|
||||||
|
echo ""
|
||||||
|
elif [ "$LOGIN" = "false" ]
|
||||||
|
then
|
||||||
|
echo "${red}Username or Password incorrect" 1>&2
|
||||||
|
rm /tmp/bmlcookies 2> /dev/null
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
echo "${red}Unknown Error" 1>&2
|
||||||
|
rm /tmp/bmlcookies 2> /dev/null
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Menu"
|
echo "Menu"
|
||||||
echo ""
|
echo ""
|
||||||
echo "1 - Accounts"
|
echo "1 - Accounts"
|
||||||
@ -18,15 +43,14 @@ echo ""
|
|||||||
printf 'Please Input: '
|
printf 'Please Input: '
|
||||||
read -r INPUT1
|
read -r INPUT1
|
||||||
|
|
||||||
|
|
||||||
if [ "$INPUT1" = "1" ]
|
if [ "$INPUT1" = "1" ]
|
||||||
then
|
then
|
||||||
curl -s -c /tmp/bmlcookie $BML_URL/dashboard | jq
|
curl -s -b /tmp/bmlcookie $BML_URL/dashboard | jq
|
||||||
elif [ "$INPUT1" = "2" ]
|
elif [ "$INPUT1" = "2" ]
|
||||||
then
|
then
|
||||||
curl -s -b /tmp/bml/cookie $BML_URL/contacts | jq
|
curl -s -b /tmp/bml/cookie $BML_URL/contacts | jq
|
||||||
else
|
else
|
||||||
echo "There was an error"
|
echo "${red}There was an error"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#curl -s -b /tmp/bmlcookie $BML_URL/contacts | jq
|
#curl -s -b /tmp/bmlcookie $BML_URL/contacts | jq
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source .env
|
|
||||||
|
|
||||||
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
|
||||||
|
|
||||||
curl -s -c /tmp/bmlcookie $BML_URL/login \
|
|
||||||
--data-raw username=$BML_USERNAME \
|
|
||||||
--data-raw password=$BML_PASSWORD \
|
|
||||||
--compressed
|
|
||||||
|
|
||||||
curl -s -b /tmp/bmlcookie $BML_URL/profile
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user