diff --git a/accounts.sh b/accounts.sh deleted file mode 100644 index a924ca6..0000000 --- a/accounts.sh +++ /dev/null @@ -1,11 +0,0 @@ -curl -s -b $COOKIE $BML_URL/dashboard \ - | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' - -# | jq -r '["Account Number","Currency","Balance"], (.["payload"] | .["dashboard"] | .[0] | [.account | .currency | .availableBalance]) | @csv' -# ["==================================================================="], \ -# (.["payload"] | .["dashboard"] | .["customer"] | .[0] | [.account | .currency | .availableBalance]) | @csv' - - -# | jq -r payload.dashboard[0].availableBalance -# | jq -r '(.["payload"] | .["dashboard"] | .["0"] | [.account | .currency | .availableBalance]) | @tsv' -source mainmenu.sh diff --git a/addcontact-bml.sh b/addcontact-bml.sh deleted file mode 100644 index 7acc357..0000000 --- a/addcontact-bml.sh +++ /dev/null @@ -1,47 +0,0 @@ - - -printf 'Account Number: ' -read -r ACCOUNT_NUMBER -VALID_NUMBER=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ - | jq -r .success) - -if [ "$VALID_NUMBER" = "true" ] -then - - ACCOUNT_NAME=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ - | jq -r '.["payload"] | .name') - CURRENCY=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ - | jq -r '.["payload"] | .currency') - echo "Account Name: $ACCOUNT_NAME" - echo "Currency: $CURRENCY" - echo "" - printf 'Contact Name: ' - read -r CONTACT_NAME - if [ "$CONTACT_NAME" = "" ] - then - CONTACT_NAME=$ACCOUNT_NAME - else - : - fi - CONTACT_NAME=`echo "$CONTACT_NAME" | sed "s/ /%20/"` - ADDCONTACT=$(curl -s -b $COOKIE $BML_URL/contacts \ - --data-raw contact_type=IAT \ - --data-raw account=$ACCOUNT_NUMBER \ - --data-raw alias=$CONTACT_NAME \ - --compressed \ - | jq -r .success) - - if [ "$ADDCONTACT" = "true" ] - then - echo "Contact added successfully" - else - echo "${red}There was an error${reset}" - source contactsmenu.sh - fi -else - echo "${red}Invalid Account${reset}" 1>&2 - source contactsmenu.sh -fi - -source contactsmenu.sh - diff --git a/addcontact-menu.sh b/addcontact-menu.sh deleted file mode 100644 index 03540d4..0000000 --- a/addcontact-menu.sh +++ /dev/null @@ -1,40 +0,0 @@ -echo "" -echo "Add Contact" -echo "" -echo "1 - BML" -echo "2 - Domestic" -echo "3 - International" -echo "4 - BillPay" -echo "5 - Go back" -echo "6 - Exit" -echo "" -printf 'Select contact type[1]: ' -read -r CONTACT_TYPE - -if [ "$CONTACT_TYPE" = "1" ] || [ "$CONTACT_TYPE" = "" ] - then - source addcontact-bml.sh -elif [ "$CONTATC_TYPE" = "2" ] - then - echo "${red}WORK IN PROGRESS${reset}" - source addcontact-menu.sh -elif [ "$CONTATC_TYPE" = "3" ] - then - echo "${red}WORK IN PROGRESS${reset}" - source addcontact-manu.sh -elif [ "$CONTATC_TYPE" = "4" ] - then - echo "${red}WORK IN PROGRESS${reset}" - source addcontact-manu.sh -elif [ "$CONTATC_TYPE" = "5" ] - then - source contactsmenu.sh -elif [ "$CONTATC_TYPE" = "6" ] - then - rm $COOKIE - exit -else - clear - echo "${red}There was an error${reset}" 1>&2 - source contactsmenu.sh -fi diff --git a/bml.sh b/bml.sh deleted file mode 100755 index 94b77b4..0000000 --- a/bml.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -#Making cookie and credentials dir -mkdir -p ~/.config/bml-cli/ -mkdir -p ~/.cache/bml-cli/ - -#Setting intial variables -BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' -BML_RESETPASS='https://www.bankofmaldives.com.mv/internetbanking/forgot_password' -COOKIE=~/.cache/bml-cli/cookie -CREDENTIALS=~/.config/bml-cli/.env - -cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 - -#Setting terminal output colors -red=`tput setaf 1` -#errorred=`tput setaf 196` -#validgreen=`tput setaf 82` -green=`tput setaf 46` -brown=`tput setaf 3` -blue=`tput setaf 4` -pink=`tput setaf 5` -cyan=`tput setaf 39` -gray=`tput setaf 7` -darkgray=`tput setaf 8` -lightred=`tput setaf 9` -lightgreen=`tput setaf 10` -yellow=`tput setaf 11` -reset=`tput sgr0` - -source osdetect.sh - -source readpass.sh diff --git a/changepassword.sh b/changepassword.sh deleted file mode 100644 index a1df7ee..0000000 --- a/changepassword.sh +++ /dev/null @@ -1,90 +0,0 @@ -read -s -p 'Enter Current Password: ' OLD_PASSWORD -echo "" -echo "" - -while true; do -read -s -p 'Enter New Password: ' NEW_PASSWORD -echo "" -read -s -p 'Repeat New Password: ' REPEAT_NEWPASSWORD -echo "" -if [ "$NEW_PASSWORD" = "$REPEAT_NEWPASSWORD" ] -then - sleep 0.2 - echo "" - break -else - echo "${red}Password do not match${reset}" - echo "Try again" - echo "" -fi -done - -while true; do -echo "Select OTP Method:" -echo "1 - Mobile" -echo "2 - Email" -echo "" -read -p "Please input: " OTPCHANNEL - -if [ "$OTPCHANNEL" = "1" ] || [ "$OTPCHANNEL" = "mobile" ] - then - OTPCHANNEL=mobile - break -elif [ "$OTPCHANNEL" = "2" ] || [ "$OTPCHANNEL" = "email" ] - then - OTPCHANNEL=email - break -else - echo "${red}Invalid Input${reset}" - echo "" -fi -done - -OLDPASSCHECHECK=$(curl -s -b $COOKIE $BML_URL/user/changepassword \ - --data-raw currentPassword=$OLD_PASSWORD \ - --data-raw newPassword=$NEW_PASSWORD \ - --data-raw newPasswordConfirmation=$REPEAT_NEWPASSWORD \ - --data-raw channel=$OTPCHANNEL \ - --compressed \ - | jq -r .success) - -if [ "$OLDPASSCHECHECK" != "true" ] - then - source changepassword.sh -else - : -fi - -if [ "$OTPCHANNEL" = "mobile" ] - then - ECHOOTPCHANNEL=$PHONE -elif [ "$OTPCHANNEL" = "email" ] - then - ECHOOTPCHANNEL=$EMAIL -fi - -echo "" -echo "${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset}" -read -p 'Enter OTP: ' OTP -echo "" -PASSCHANGED=$(curl -s -b $COOKIE $BML_URL/user/changepassword \ - --data-raw currentPassword=$OLD_PASSWORD \ - --data-raw newPassword=$NEW_PASSWORD \ - --data-raw newPasswordConfirmation=$REPEAT_NEWPASSWORD \ - --data-raw channel=$OTPCHANNEL \ - --data-raw otp=$OTP \ - --compressed \ - | jq -r .success) - -OLD_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) -NEW_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) -REPEAT_NEWPASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) - -if [ "$PASSCHANGED" != "true" ] - then - echo "${red}Failed to change password${reset}" -else - echo "${lightgreen}Password changed succesfully ${reset}" - rm $CREDENTIALS - source readpass.sh -fi diff --git a/contactsmenu.sh b/contactsmenu.sh deleted file mode 100644 index ed81d5d..0000000 --- a/contactsmenu.sh +++ /dev/null @@ -1,39 +0,0 @@ -echo "" -echo "Contacts" -echo "" -echo "1 - List Contacts" -echo "2 - Add Contact" -echo "3 - Delete Contact" -echo "4 - Go back" -echo "" -printf 'Please Input: ' -read -r CONTACTS - -if [ "$CONTACTS" = "1" ] -then - source listcontacts.sh -elif [ "$CONTACTS" = "2" ] -then - source addcontact-menu.sh -elif [ "$CONTACTS" = "3" ] -then - source deletecontact.sh -elif [ "$CONTACTS" = "4" ] || [ "$CONTACTS" = "back" ] -then - sleep 0.2 - source mainmenu.sh -elif [ "$CONTACTS" = "clear" ] -then - sleep 0.2 - clear - source contactsmenu.sh -elif [ "$CONTACTS" = "exit" ] -then - echo "Cleaning up.." - rm $COOKIE - sleep 0.2 - exit -else - echo ${red}Invalid input:${yellow} $CONTACTS ${reset} 1>&2 - source contactsmenu.sh -fi diff --git a/deletecontact.sh b/deletecontact.sh deleted file mode 100644 index e756199..0000000 --- a/deletecontact.sh +++ /dev/null @@ -1,17 +0,0 @@ - - -printf "Enter Contact ID: " -read -r CONATACT_ID -DELETESUCCESS=$(curl -s -b $COOKIE $BML_URL/contacts/$CONATACT_ID \ - --data-raw _method=delete \ - --compressed \ - | jq -r .code) - -if [ "$DELETESUCCESS" = "0" ] -then - echo Contact Deleted - source contactsmenu.sh -else - echo "${red}There was an error${reset}" - source contactsmenu.sh -fi diff --git a/installer.sh b/installer.sh deleted file mode 100644 index 998e1ca..0000000 --- a/installer.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -cd /tmp/ -git clone https://github.com/shihaamabr/bml-cli.git -mkdir -p /opt/sar/bml-cli/ -mv bml-cli/* /opt/sar/bml-cli/ -echo "#!/bin/bash" > /usr/bin/bml-cli -echo "source /opt/sar/bml-cli/bml.sh" >> /usr/bin/bml-cli -chmod 755 /usr/bin/bml-cli -rm -rf bml-cli/ -echo "Installation Complete" diff --git a/listcontacts.sh b/listcontacts.sh deleted file mode 100644 index ec58136..0000000 --- a/listcontacts.sh +++ /dev/null @@ -1,3 +0,0 @@ -curl -s -b $COOKIE $BML_URL/contacts \ -| jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' -source contactsmenu.sh diff --git a/login.sh b/login.sh deleted file mode 100644 index 19b1f0a..0000000 --- a/login.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -#login and generate cookie - -LOGIN=$(curl -s -c $COOKIE $BML_URL/login \ - --data-raw username=$BML_USERNAME \ - --data-raw password=${BML_PASSWORD} \ - --compressed \ - | jq -r .code) -#check if login was success -if [ "$LOGIN" = "0" ] - then - source savepass.sh -elif [ "$LOGIN" = "20" ] - then - echo "${red}Account Locked!${reset}" - echo "${lightred}Please reset password and login again.${reset}" - echo "" - if [ "$OS" = "macos" ] - then - open $BML_RESETPASS - elif [ "$OS" = "windows" ] - then - cmd.exe /C START $BML_RESETPASS - elif [ "$OS" = "android" ] - then - am start -a android.intent.action.VIEW -d $BML_RESETPASS - else - xdg-open $BML_RESETPASS - fi - source readpass.sh -elif [ "$LOGIN" = "2" ] - then - source readpass.sh -elif [ "$LOGIN" = "37" ] - then - echo "${red}Down for Maintenance${reset}" 1>&2 - echo "Try again later" - exit -else - echo "${red}Unknown Error${reset}" 1>&2 - exit -fi - diff --git a/logout.sh b/logout.sh deleted file mode 100644 index f35bba6..0000000 --- a/logout.sh +++ /dev/null @@ -1,5 +0,0 @@ -rm $CREDENTIALS -rm $COOKIE -echo "Cleaning up.." -sleep 0.4 -exit diff --git a/mainmenu.sh b/mainmenu.sh deleted file mode 100644 index fd630b4..0000000 --- a/mainmenu.sh +++ /dev/null @@ -1,57 +0,0 @@ -echo "Main Menu" -echo "" -echo "1 - Accounts" -echo "2 - Transfer" -echo "3 - Contacts" -echo "4 - Activities" -echo "5 - Services" -echo "6 - Settings" -echo "" -printf 'Please Input: ' -read -r MENU - -if [ "$MENU" = "1" ] - then - echo "WIP" - sleep 2 - #source mainmenu.sh - source accounts.sh -elif [ "$MENU" = "2" ] - then - echo "WIP" - sleep 2 - source mainmenu.sh - #source transfer.sh -elif [ "$MENU" = "3" ] - then - source contactsmenu.sh -elif [ "$MENU" = "4" ] - then - echo "WIP" - sleep 2 - source mainmenu.sh - source activities.sh -elif [ "$MENU" = "5" ] - then - echo "WIP" - sleep 2 - source mainmenu.sh - source services.sh -elif [ "$MENU" = "6" ] - then - source settings-menu.sh -elif [ "$MENU" = "clear" ] - then - clear - sleep 0.2 - source mainmenu.sh -elif [ "$MENU" = "exit" ] - then - echo "cleaning up..." - rm $COOKIE - sleep 0.2 - exit -else - echo ${red}Invalid input:${yellow} $MENU ${reset} 1>&2 - source mainmenu.sh -fi diff --git a/osdetect.sh b/osdetect.sh deleted file mode 100644 index 592ebb6..0000000 --- a/osdetect.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -WSL1=$(uname -r | grep -oE Microsoft) -WSL2=$(uname -r | grep -oE microsoft) -MAC=$(uname -a | grep -oE Darwin | tail -n1) -ANDROID=$(uname -a | grep -oE Android) - -if [ "$WSL1" = "Microsoft" ] || [ "$WSL2" = "microsoft" ] - then - OS=windows - #echo ${red}WSL Not Supported!${reset} 1>&2 - #exit -elif [ "$MAC" = "Darwin" ] - then - OS=macos - export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" - #echo ${red}MacOS Not Supported!${reset} 1>&2 - #exit -elif [ "$ANDROID" = "Android" ] - then - OS=android -else - : -fi - -source readpass.sh - diff --git a/readpass.sh b/readpass.sh deleted file mode 100644 index dbe0e49..0000000 --- a/readpass.sh +++ /dev/null @@ -1,32 +0,0 @@ -if [ -f $CREDENTIALS ] -then - source $CREDENTIALS -# echo "Attempting to login with saved credentials" - read -s -p 'Enter Pin: ' PIN - echo "" - BML_USERNAME=$(echo ${BML_USERNAME} |openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) - BML_PASSWORD=$(echo ${BML_PASSWORD} |openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) - if [ "$LOGIN" = "2" ] - then - echo "${red}Login Required${reset}" - rm $CREDENTIALS 2> /dev/null - read -p 'Username: ' BML_USERNAME - read -s -p 'Password: ' BML_PASSWORD - echo "" - else - : - fi - - - -elif [ ! -f $CREDENTIALS ] -then - echo "${red}Login Required${reset}" - read -p 'Username: ' BML_USERNAME - read -s -p 'Password: ' BML_PASSWORD - echo "" -else - : -fi - -source login.sh diff --git a/savepass.sh b/savepass.sh deleted file mode 100644 index 5eb6d49..0000000 --- a/savepass.sh +++ /dev/null @@ -1,37 +0,0 @@ -if [ ! -f $CREDENTIALS ] -then - if [ "$LOGIN" = "0" ] - then - read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN - if [ "$SAVE_LOGIN" = "Y" ] || [ "$SAVE_LOGIN" = "y" ] - then - read -s -p 'Enter Pin: ' PIN - echo "" - read -s -p 'Repeat Pin: ' REPEAT_PIN - if [ "$PIN" = "$REPEAT_PIN" ] - then - echo "" - echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" - BML_USERNAME=$(echo "${BML_USERNAME}" | openssl enc -e -des3 -base64 -pass pass:${PIN} -pbkdf2) - BML_PASSWORD=$(echo "${BML_PASSWORD}" | openssl enc -e -des3 -base64 -pass pass:${PIN} -pbkdf2) - echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS - echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS - - else - echo "" - echo "${red}Pin do not match${reset}" - source savepass.sh - fi - else - : - fi - else - source readpass.sh - fi -else - : -fi - -BML_USERNAME=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) -BML_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) -source welcome.sh diff --git a/settings-menu.sh b/settings-menu.sh deleted file mode 100644 index 0b7d995..0000000 --- a/settings-menu.sh +++ /dev/null @@ -1,34 +0,0 @@ -echo "" -echo "Settings" -echo "" -echo "1 - Logout and Delete saved credentials" -echo "2 - Change Password" -echo "3 - Go Back" -echo "" -printf 'Please Input: ' -read -r SETTINGS - -if [ "$SETTINGS" = "1" ] -then - source logout.sh -elif [ "$SETTINGS" = "2" ] -then - source changepassword.sh -elif [ "$SETTINGS" = "3" ] || [ "$SETTINGS" = "back" ] -then - source mainmenu.sh -elif [ "$SETTINGS" = "clear" ] -then - sleep 0.2 - clear - source settings-menu.sh -elif [ "$SETTINGS" = "exit" ] -then - echo "Cleaning up.." - rm $COOKIE - sleep 0.2 - exit -else - echo ${red}Invalid input:${yellow} $SETTINGS ${reset} 1>&2 - source settings-menu.sh -fi diff --git a/welcome.sh b/welcome.sh deleted file mode 100644 index 71b84d8..0000000 --- a/welcome.sh +++ /dev/null @@ -1,41 +0,0 @@ -#Requesting for User profile after login and regex to grap the Full name -REQPRO=$(curl -s -b $COOKIE $BML_URL/profile) -PERSONALPROFILE=$(echo $REQPRO \ - | jq -r '.payload | .profile | .[] | .profile' \ - | head -n 1) -curl -s -b $COOKIE $BML_URL/profile \ - --data-raw profile=$PERSONALPROFILE \ - --compressed > /dev/null - -USERINFO=$(curl -s -b $COOKIE $BML_URL/userinfo \ - | jq -r '.["payload"] | .["user"]') - -NAME=$(echo $USERINFO \ - | jq -r .fullname) -PHONE=$(echo $USERINFO \ - | jq -r .mobile_phone) -EMAIL=$(echo $USERINFO \ - | jq -r .email) -DOB=$(echo $USERINFO \ - | jq -r .birthdate \ - | cut -d 'T' -f 1) -IDCARD=$(echo $USERINFO \ - | jq -r .idcard) - -#display a Welcome message with fullname -echo "${red}" -echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" -echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" -echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" -echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" -echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" -echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" -echo "${reset}" -echo ${green}Welcome ${reset}$NAME -echo "" -echo ${cyan}Phone${reset}: $PHONE -echo ${cyan}Email${reset}: $EMAIL -echo ${cyan}Birthday${reset}: $DOB -echo ${cyan}ID Card${reset}: $IDCARD -echo "" -source mainmenu.sh