added settings menu, adding contacts and bugs to fix later
This commit is contained in:
parent
688d7ed6e7
commit
afb1b7bd07
@ -3,33 +3,28 @@
|
|||||||
source .env
|
source .env
|
||||||
|
|
||||||
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
||||||
|
COOKIE=/tmp/bmlcookie
|
||||||
red=`tput setaf 1`
|
red=`tput setaf 1`
|
||||||
green=`tput setaf 2`
|
green=`tput setaf 2`
|
||||||
reset=`tput sgr0`
|
reset=`tput sgr0`
|
||||||
|
|
||||||
LOGIN=$(curl -s -c /tmp/bmlcookie $BML_URL/login \
|
LOGIN=$(curl -s -c $COOKIE $BML_URL/login \
|
||||||
--data-raw username=$BML_USERNAME \
|
--data-raw username=$BML_USERNAME \
|
||||||
--data-raw password=$BML_PASSWORD \
|
--data-raw password=$BML_PASSWORD \
|
||||||
--compressed \
|
--compressed \
|
||||||
| awk -F 'success":' '{print $2}' \
|
| jq -r .success)
|
||||||
| cut -f1 -d ',' )
|
|
||||||
|
|
||||||
if [ "$LOGIN" = "true" ]
|
if [ "$LOGIN" = "true" ]
|
||||||
then
|
then
|
||||||
NAME=$(curl -s -b /tmp/bmlcookie $BML_URL/profile \
|
NAME=$(curl -s -b $COOKIE $BML_URL/profile \
|
||||||
| awk -F 'fullname":"' '{print $2}' \
|
| awk -F 'fullname":"' '{print $2}' \
|
||||||
| cut -f1 -d '"')
|
| cut -f1 -d '"')
|
||||||
echo ""
|
echo ""
|
||||||
echo ${green}Welcome ${reset}$NAME
|
echo ${green}Welcome ${reset}$NAME
|
||||||
echo ""
|
echo ""
|
||||||
elif [ "$LOGIN" = "false" ]
|
|
||||||
then
|
|
||||||
echo "${red}Username or Password incorrect" 1>&2
|
|
||||||
rm /tmp/bmlcookies 2> /dev/null
|
|
||||||
exit
|
|
||||||
else
|
else
|
||||||
echo "${red}Unknown Error" 1>&2
|
echo "${red}An error occured, Please check Username and Password" 1>&2
|
||||||
rm /tmp/bmlcookies 2> /dev/null
|
rm $COOKIE 2> /dev/null
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -39,18 +34,51 @@ echo "1 - Accounts"
|
|||||||
echo "2 - Contacts"
|
echo "2 - Contacts"
|
||||||
echo "3 - Activities"
|
echo "3 - Activities"
|
||||||
echo "4 - Services"
|
echo "4 - Services"
|
||||||
|
echo "5 - Settings"
|
||||||
echo ""
|
echo ""
|
||||||
printf 'Please Input: '
|
printf 'Please Input: '
|
||||||
read -r INPUT1
|
read -r MENU
|
||||||
|
|
||||||
if [ "$INPUT1" = "1" ]
|
if [ "$MENU" = "1" ]
|
||||||
then
|
then
|
||||||
curl -s -b /tmp/bmlcookie $BML_URL/dashboard | jq
|
curl -s -b $COOKIE $BML_URL/dashboard | jq
|
||||||
elif [ "$INPUT1" = "2" ]
|
elif [ "$MENU" = "2" ]
|
||||||
then
|
then
|
||||||
curl -s -b /tmp/bml/cookie $BML_URL/contacts | jq
|
echo ""
|
||||||
|
echo "Contacts"
|
||||||
|
echo ""
|
||||||
|
echo "1 - Transfer"
|
||||||
|
echo "2 - Add Contact"
|
||||||
|
echo "3 - Delete Conact"
|
||||||
|
echo ""
|
||||||
|
printf 'Please Input:'
|
||||||
|
read -r CONTACS
|
||||||
|
|
||||||
|
if [ "$CONTACS" = "1" ]
|
||||||
|
then
|
||||||
|
curl -s -b $COOKIE $BML_URL/contacts | jq
|
||||||
|
elif [ "$CONTACS" = "2" ]
|
||||||
|
then
|
||||||
|
printf 'Account Number:'
|
||||||
|
read -r ACCOUNT_NAME
|
||||||
|
printf 'Name:'
|
||||||
|
read -r ACCOUNT_NAME
|
||||||
|
curl -s -b $COOKIE $BML_URL | jq
|
||||||
|
elif [ "$CONTACS" = "3" ]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
elif [ "$MENU" = "3" ]
|
||||||
|
then
|
||||||
|
curl -s -b $COOKIE $BML_URL/activities | jq
|
||||||
|
elif [ "$MENU" = "4" ]
|
||||||
|
then
|
||||||
|
curl -s -b $COOKIE $BML_URL/services/applications/context | jq
|
||||||
|
elif [ "$MENU" = "5" ]
|
||||||
|
then
|
||||||
|
curl -s -b $COOKIE $BML_URL/settings | jq
|
||||||
else
|
else
|
||||||
echo "${red}There was an error"
|
echo "${red}There was an error"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#curl -s -b /tmp/bmlcookie $BML_URL/contacts | jq
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user