From 612ec49ebdd217820eece41ce2467a6b3d5ee2c5 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 26 Apr 2021 10:26:55 +0500 Subject: [PATCH 001/133] Updated readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a587b2c..3df3be0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ - Requiments `curl` `jq` - +Make sure you have both of them installed +`sudo apt install curl jq` on Ubuntu ### known bugs - colored texts do not work in termux @@ -17,10 +18,9 @@ git clone https://github.com/shihaamabr/bmlcli cd bmlcli/ -echo "BML_USERNAME=xxxxxxxxx" > .env -echo "BML_PASSWORD=yyyyyyyyyy" >> .env - chmod +x bml.sh ./bml.sh ``` +- Do NOT save password if password contain one of the following characters +` | ^ $ & ; : ( )` -- 2.47.2 From 73fee9549dbf43ac29b23e02d5ffc6ff02796fe1 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 26 Apr 2021 10:31:09 +0500 Subject: [PATCH 002/133] Updated README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3df3be0..3b71e93 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ ### can you pr ascii art lmao - Requiments -`curl` `jq` -Make sure you have both of them installed +`curl` `jq` \ +Make sure you have both of them installed \ `sudo apt install curl jq` on Ubuntu ### known bugs - colored texts do not work in termux -- 2.47.2 From 1a0712ec36bcf58a3039ce7b27be6ef21713da53 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 26 Apr 2021 10:36:12 +0500 Subject: [PATCH 003/133] Added Installation --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b71e93..e1e57f5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Make sure you have both of them installed \ - colored texts do not work in termux -### Installation +### Use from source - Recommended ``` git clone https://github.com/shihaamabr/bmlcli @@ -22,5 +22,8 @@ chmod +x bml.sh ./bml.sh ``` +### Installation - NOT Recommended (for now) +`curl -sL "https://raw.githubusercontent.com/shihaamabr/bmlcli/main/bml.sh" | sudo tee /usr/bin/bml-cli >/dev/null && sudo chmod 755 /usr/bin/bml-cli` + - Do NOT save password if password contain one of the following characters ` | ^ $ & ; : ( )` -- 2.47.2 From c69668cb4da0a1ad9f5c95b22217162a35c23109 Mon Sep 17 00:00:00 2001 From: Naffah Abdulla Rasheed <52469245+nnaaffffuu@users.noreply.github.com> Date: Mon, 26 Apr 2021 10:54:10 +0500 Subject: [PATCH 004/133] Fixed some typos --- install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..e69de29 -- 2.47.2 From 4d11af5658bd73d9c0f39e1080a10cf473e39731 Mon Sep 17 00:00:00 2001 From: Naffah Abdulla Rasheed <52469245+nnaaffffuu@users.noreply.github.com> Date: Mon, 26 Apr 2021 10:55:56 +0500 Subject: [PATCH 005/133] Fixed some typos --- README.md | 15 ++++----------- bml.sh | 6 +++--- install.sh | 1 + 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a587b2c..49f54ba 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,19 @@ # Bank of Maldives CLI written in bash -## under dev, lots of things are broken. +Under development, lots of things are broken. If possible, pr ascii art lmao. -### can you pr ascii art lmao - -- Requiments +## Requirements `curl` `jq` -### known bugs +## known bugs - colored texts do not work in termux - -### Installation +## Installation ``` git clone https://github.com/shihaamabr/bmlcli cd bmlcli/ -echo "BML_USERNAME=xxxxxxxxx" > .env -echo "BML_PASSWORD=yyyyyyyyyy" >> .env - chmod +x bml.sh ./bml.sh - ``` diff --git a/bml.sh b/bml.sh index 7e2f4e3..48e712c 100755 --- a/bml.sh +++ b/bml.sh @@ -51,8 +51,8 @@ if [ "$LOGIN" = "true" ] # curl -s -b $COOKIE $BML_URL/userinfo echo "" else - #Display error if login was not succuessfull and delete cookie - echo "${red}An error occured, Please check Username and Password" 1>&2 + #Display error if login was not successful and delete cookie + echo "${red}An error occurred, Please check Username and Password" 1>&2 rm $COOKIE 2> /dev/null exit fi @@ -79,7 +79,7 @@ elif [ "$MENU" = "2" ] echo "" echo "1 - Transfer" echo "2 - Add Contact" - echo "3 - Delete Conact" + echo "3 - Delete Contact" echo "" printf 'Please Input: ' read -r CONTACS diff --git a/install.sh b/install.sh index e69de29..096fa84 100644 --- a/install.sh +++ b/install.sh @@ -0,0 +1 @@ +curl -sL "https://raw.githubusercontent.com/shihaamabr/bmlcli/main/bml.sh" | sudo tee /usr/bin/bml-cli >/dev/null && sudo chmod 755 /usr/bin/bml-cli \ No newline at end of file -- 2.47.2 From ce455ec2945b9a93932f8099fc3752debcddcb98 Mon Sep 17 00:00:00 2001 From: Naffah Abdulla Rasheed <52469245+nnaaffffuu@users.noreply.github.com> Date: Mon, 26 Apr 2021 11:25:57 +0500 Subject: [PATCH 006/133] Updated README.md --- README.md | 34 +++++++++++++++++++++------ pasrjsontest.sh => paser_json_test.sh | 0 2 files changed, 27 insertions(+), 7 deletions(-) rename pasrjsontest.sh => paser_json_test.sh (100%) mode change 100755 => 100644 diff --git a/README.md b/README.md index 49f54ba..3c664fa 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,39 @@ -# Bank of Maldives CLI written in bash +# bml-cli -Under development, lots of things are broken. If possible, pr ascii art lmao. +BML CLI written in bash. This project is currently under development, and a lots of things are broken. If possible, pr ascii art lmao. ## Requirements `curl` `jq` -## known bugs -- colored texts do not work in termux +## Bugs +- Colored texts do not work in Termux ## Installation -``` -git clone https://github.com/shihaamabr/bmlcli -cd bmlcli/ +### Recommended + +``` +git clone https://github.com/shihaamabr/bml-cli + +cd bml-cli/ chmod +x bml.sh ./bml.sh ``` +### Not Recommended + +``` +chmod +x install.sh +./install.sh +``` + +## Todo + +- [x] Get today's history +- [x] Get Account details +- [x] Get contacts +- [x] Add contacts +- [x] Delete contacts +- [ ] Get history from a date range +- [ ] Make Transfer to a given account number +- [ ] Make transfers to contact diff --git a/pasrjsontest.sh b/paser_json_test.sh old mode 100755 new mode 100644 similarity index 100% rename from pasrjsontest.sh rename to paser_json_test.sh -- 2.47.2 From 5db24ede8f7e2f6afc3bd15cb6f08a688127299c Mon Sep 17 00:00:00 2001 From: nnaaffffuu Date: Tue, 27 Apr 2021 02:47:59 +0500 Subject: [PATCH 007/133] Update README.md --- README.md | 38 ++++++++++++++++---------- install.sh | 1 + pasrjsontest.sh => parser_json_test.sh | 0 3 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 install.sh rename pasrjsontest.sh => parser_json_test.sh (100%) diff --git a/README.md b/README.md index e1e57f5..7235e77 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,26 @@ -# Bank of Maldives CLI written in bash +# Bank of Maldives CLI +BML CLI written in Bash. This project is currently under development and a lot of things are broken. -## under dev, lots of things are broken. +## Requiments +`curl` `jq` -### can you pr ascii art lmao +### Ubuntu +`sudo apt install curl jq` -- Requiments -`curl` `jq` \ -Make sure you have both of them installed \ -`sudo apt install curl jq` on Ubuntu -### known bugs -- colored texts do not work in termux +### Fedora +`sudo dnf install curl jq` +### Arch +`sudo pacman -S curl jq` -### Use from source - Recommended +## Bugs +- Colored texts do not work in Termux +- Do **NOT** save passwords that contain one of the following characters +` | ^ $ & ; : ( )` + +## Installation + +### Recommended ``` git clone https://github.com/shihaamabr/bmlcli @@ -20,10 +28,10 @@ cd bmlcli/ chmod +x bml.sh ./bml.sh - ``` -### Installation - NOT Recommended (for now) -`curl -sL "https://raw.githubusercontent.com/shihaamabr/bmlcli/main/bml.sh" | sudo tee /usr/bin/bml-cli >/dev/null && sudo chmod 755 /usr/bin/bml-cli` -- Do NOT save password if password contain one of the following characters -` | ^ $ & ; : ( )` +### Not Recommended +``` +chmod +x install.sh +./install.sh +``` \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..46301d0 --- /dev/null +++ b/install.sh @@ -0,0 +1 @@ +curl -sL "https://raw.githubusercontent.com/shihaamabr/bml-cli/main/bml.sh" | sudo tee /usr/bin/bml-cli >/dev/null && sudo chmod 755 /usr/bin/bml-cli \ No newline at end of file diff --git a/pasrjsontest.sh b/parser_json_test.sh similarity index 100% rename from pasrjsontest.sh rename to parser_json_test.sh -- 2.47.2 From b92969d5c388084162356bf0c2892134f3a198eb Mon Sep 17 00:00:00 2001 From: nnaaffffuu Date: Tue, 27 Apr 2021 19:16:08 +0500 Subject: [PATCH 008/133] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7235e77..f72bc71 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ BML CLI written in Bash. This project is currently under development and a lot o ### Recommended ``` -git clone https://github.com/shihaamabr/bmlcli +git clone https://github.com/shihaamabr/bml-cli -cd bmlcli/ +cd bml-cli chmod +x bml.sh ./bml.sh -- 2.47.2 From 0f4be5a79d57a15272a60a429b249f64298fb868 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 27 Apr 2021 23:10:51 +0500 Subject: [PATCH 009/133] Making Modular? --- bml-old.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ bml.sh | 64 +---------------------------------------------- contactsmenu.sh | 33 +++++++++++++++++++++++++ mainmenu.sh | 40 ++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+), 63 deletions(-) create mode 100755 bml-old.sh create mode 100755 contactsmenu.sh create mode 100755 mainmenu.sh diff --git a/bml-old.sh b/bml-old.sh new file mode 100755 index 0000000..4545382 --- /dev/null +++ b/bml-old.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +#display menu +echo "Menu" +echo "" +echo "1 - Accounts" +echo "2 - Contacts" +echo "3 - Activities" +echo "4 - Services" +echo "5 - Settings" +echo "" +printf 'Please Input: ' +read -r MENU + +if [ "$MENU" = "1" ] + then + curl -s -b $COOKIE $BML_URL/dashboard | jq +elif [ "$MENU" = "2" ] + then + 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 -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' + elif [ "$CONTACS" = "2" ] + then + 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 + printf 'Name: ' + curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER | jq -r . + read -r ACCOUNT_NAME + curl -s -b $COOKIE $BML_URL | jq + else + echo "${red}Invalid Account" 1>&2 + fi + 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 + echo "${red}There was an error" +fi + diff --git a/bml.sh b/bml.sh index 7e2f4e3..785858a 100755 --- a/bml.sh +++ b/bml.sh @@ -50,6 +50,7 @@ if [ "$LOGIN" = "true" ] echo ${green}Welcome ${reset}$NAME # curl -s -b $COOKIE $BML_URL/userinfo echo "" + source mainmenu.sh else #Display error if login was not succuessfull and delete cookie echo "${red}An error occured, Please check Username and Password" 1>&2 @@ -57,67 +58,4 @@ else exit fi -#display menu -echo "Menu" -echo "" -echo "1 - Accounts" -echo "2 - Contacts" -echo "3 - Activities" -echo "4 - Services" -echo "5 - Settings" -echo "" -printf 'Please Input: ' -read -r MENU - -if [ "$MENU" = "1" ] - then - curl -s -b $COOKIE $BML_URL/dashboard | jq -elif [ "$MENU" = "2" ] - then - 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 -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' - elif [ "$CONTACS" = "2" ] - then - 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 - printf 'Name: ' - curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER | jq -r . - read -r ACCOUNT_NAME - curl -s -b $COOKIE $BML_URL | jq - else - echo "${red}Invalid Account" 1>&2 - fi - 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 - echo "${red}There was an error" -fi diff --git a/contactsmenu.sh b/contactsmenu.sh new file mode 100755 index 0000000..3415b08 --- /dev/null +++ b/contactsmenu.sh @@ -0,0 +1,33 @@ +echo "" +echo "Contacts" +echo "" +echo "1 - List Contacts" +echo "2 - Add Contact" +echo "3 - Delete Conact" +echo "4 - Go back" +echo "5 - Exit" +echo "" +printf 'Please Input: ' +read -r CONTATCS + +if [ "$CONTATCS" = "1" ] + then + source listcontact.sh +elif [ "$CONTATCS" = "2" ] + then + source addcontact.sh +elif [ "$CONTATCS" = "3" ] + then + source delete contact.sh +elif [ "$CONTATCS" = "4" ] + then + source mainmenu.sh +elif [ "$CONTATCS" = "5" ] + then + rm $COOKIE + exit +else + echo "${red}There was an error${reset}" 1>&2 + clear + source contactsmenu.sh +fi diff --git a/mainmenu.sh b/mainmenu.sh new file mode 100755 index 0000000..bf63e80 --- /dev/null +++ b/mainmenu.sh @@ -0,0 +1,40 @@ +echo "Menu" +echo "" +echo "1 - Accounts" +echo "2 - Transfer" +echo "3 - Contacts" +echo "4 - Activities" +echo "5 - Services" +echo "6 - Settings" +echo "7 - Exit" +echo "" +printf 'Please Input: ' +read -r MENU + +if [ "$MENU" = "1" ] + then + source accounts.sh +elif [ "$MENU" = "2" ] + then + source transfer.sh +elif [ "$MENU" = "3" ] + then + source contactsmenu.sh +elif [ "$MENU" = "4" ] + then + source activities.sh +elif [ "$MENU" = "5" ] + then + source services.sh +elif [ "$MENU" = "6" ] + then + source settingsmenu.sh +elif [ "$MENU" = "7" ] + then + rm $COOKIE + exit +else + echo "${red}There was an error${reset}" 1>&2 + clear + source mainmenu.sh +fi -- 2.47.2 From 3908b5dde958ce01f0b004a7c3c99af72642c4f9 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 01:24:02 +0500 Subject: [PATCH 010/133] added adding contacts --- addcontact-bml.sh | 40 ++++++++++++++++++++++++++++++++++++++++ addcontact-menu.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ contactsmenu.sh | 7 ++++--- listcontacts.sh | 3 +++ mainmenu.sh | 0 parser_json_test.sh | 4 ++-- 6 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 addcontact-bml.sh create mode 100644 addcontact-menu.sh mode change 100755 => 100644 contactsmenu.sh create mode 100644 listcontacts.sh mode change 100755 => 100644 mainmenu.sh mode change 100755 => 100644 parser_json_test.sh diff --git a/addcontact-bml.sh b/addcontact-bml.sh new file mode 100644 index 0000000..4c18261 --- /dev/null +++ b/addcontact-bml.sh @@ -0,0 +1,40 @@ + + +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 + + 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: $NAME" + echo "Currency: $CURRENCY" + echo "" + printf 'Contact Name: ' + read -r CONTACT_NAME + 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 new file mode 100644 index 0000000..55753b1 --- /dev/null +++ b/addcontact-menu.sh @@ -0,0 +1,43 @@ +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" ] + then + source addcontact-bml.sh +elif [ "$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/contactsmenu.sh b/contactsmenu.sh old mode 100755 new mode 100644 index 3415b08..773ec28 --- a/contactsmenu.sh +++ b/contactsmenu.sh @@ -12,10 +12,10 @@ read -r CONTATCS if [ "$CONTATCS" = "1" ] then - source listcontact.sh + source listcontacts.sh elif [ "$CONTATCS" = "2" ] then - source addcontact.sh + source addcontact-menu.sh elif [ "$CONTATCS" = "3" ] then source delete contact.sh @@ -25,9 +25,10 @@ elif [ "$CONTATCS" = "4" ] elif [ "$CONTATCS" = "5" ] then rm $COOKIE + echo "Cleaning up.." exit else - echo "${red}There was an error${reset}" 1>&2 clear + echo "${red}There was an error${reset}" 1>&2 source contactsmenu.sh fi diff --git a/listcontacts.sh b/listcontacts.sh new file mode 100644 index 0000000..f517801 --- /dev/null +++ b/listcontacts.sh @@ -0,0 +1,3 @@ +curl -s -b $COOKIE $BML_URL/contacts \ +| jq -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' +source contactsmenu.sh diff --git a/mainmenu.sh b/mainmenu.sh old mode 100755 new mode 100644 diff --git a/parser_json_test.sh b/parser_json_test.sh old mode 100755 new mode 100644 index 6513eab..538b04d --- a/parser_json_test.sh +++ b/parser_json_test.sh @@ -10,9 +10,9 @@ curl -s -c $COOKIE $BML_URL/login \ --compressed > /dev/null curl -s -b $COOKIE $BML_URL/profile > /dev/null -curl -s -b $COOKIE $BML_URL/contacts | jq -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' +#curl -s -b $COOKIE $BML_URL/contacts | jq -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' #get this to render nicely in a table, similar to contacts #curl -s -b $COOKIE $BML_URL/dashboard -curl -s -b $COOKIE $BML_URL/api/validate/account/7730000359348 +curl -s -b $COOKIE $BML_URL/api/validate/account/7701134192101 -- 2.47.2 From 2df1b71f38b036897edb9d032b63ddc5f52ff464 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 01:24:56 +0500 Subject: [PATCH 011/133] added test files to ignore list --- parser_json_test.sh | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 parser_json_test.sh diff --git a/parser_json_test.sh b/parser_json_test.sh deleted file mode 100644 index 538b04d..0000000 --- a/parser_json_test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -source .env - -BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' -COOKIE=/tmp/bmlcookie -curl -s -c $COOKIE $BML_URL/login \ - --data-raw username=$BML_USERNAME \ - --data-raw password=$BML_PASSWORD \ - --compressed > /dev/null -curl -s -b $COOKIE $BML_URL/profile > /dev/null - -#curl -s -b $COOKIE $BML_URL/contacts | jq -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' - -#get this to render nicely in a table, similar to contacts -#curl -s -b $COOKIE $BML_URL/dashboard - -curl -s -b $COOKIE $BML_URL/api/validate/account/7701134192101 -- 2.47.2 From f79d9fb2ef42659946db9e52946733eaa3f55f20 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 01:27:12 +0500 Subject: [PATCH 012/133] removed legacy files --- bml-old.sh | 66 ------------------------------------------------------ 1 file changed, 66 deletions(-) delete mode 100755 bml-old.sh diff --git a/bml-old.sh b/bml-old.sh deleted file mode 100755 index 4545382..0000000 --- a/bml-old.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -#display menu -echo "Menu" -echo "" -echo "1 - Accounts" -echo "2 - Contacts" -echo "3 - Activities" -echo "4 - Services" -echo "5 - Settings" -echo "" -printf 'Please Input: ' -read -r MENU - -if [ "$MENU" = "1" ] - then - curl -s -b $COOKIE $BML_URL/dashboard | jq -elif [ "$MENU" = "2" ] - then - 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 -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' - elif [ "$CONTACS" = "2" ] - then - 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 - printf 'Name: ' - curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER | jq -r . - read -r ACCOUNT_NAME - curl -s -b $COOKIE $BML_URL | jq - else - echo "${red}Invalid Account" 1>&2 - fi - 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 - echo "${red}There was an error" -fi - -- 2.47.2 From 46424c86ee46ef10ca9bc3a39f1cc2252b6eee3b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 01:46:14 +0500 Subject: [PATCH 013/133] separated password.sh and login.sh --- bml.sh | 56 +++++------------------------------------------------ login.sh | 28 +++++++++++++++++++++++++++ mainmenu.sh | 2 +- password.sh | 34 ++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 52 deletions(-) create mode 100644 login.sh create mode 100644 password.sh diff --git a/bml.sh b/bml.sh index 785858a..e687e3e 100755 --- a/bml.sh +++ b/bml.sh @@ -1,4 +1,8 @@ #!/bin/bash + + + +#Setting intial variables BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' COOKIE=/tmp/bmlcookie @@ -7,55 +11,5 @@ red=`tput setaf 1` green=`tput setaf 2` reset=`tput sgr0` -#importing saved credentials -source .env 2> /dev/null - -#what to do if credentials not saved -if [ "$BML_USERNAME" = "" ] -then - echo ${red}Credentials not found in .env file${reset} - echo "" - read -p 'Username: ' BML_USERNAME - read -s -p 'Password: ' BML_PASSWORD - echo "" - read -p 'Do you want to save login? [Y/N] ' SAVE_LOGIN - - if [ "$SAVE_LOGIN" = "Y" ] - then - echo BML_USERNAME=$BML_USERNAME > .env - echo BML_PASSWORD=$BML_PASSWORD >> .env - else - : - fi - echo "" -else - : -fi - -#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 .success) -#check if login was success -if [ "$LOGIN" = "true" ] - then - #Requesting for User profile after login and regex to grap the Full name - NAME=$(curl -s -b $COOKIE $BML_URL/profile \ - | awk -F 'fullname":"' '{print $2}' \ - | cut -f1 -d '"') - #display a Welcome message with fullname - echo "" - echo ${green}Welcome ${reset}$NAME -# curl -s -b $COOKIE $BML_URL/userinfo - echo "" - source mainmenu.sh -else - #Display error if login was not succuessfull and delete cookie - echo "${red}An error occured, Please check Username and Password" 1>&2 - rm $COOKIE 2> /dev/null - exit -fi - +source password.sh diff --git a/login.sh b/login.sh new file mode 100644 index 0000000..58c7d0c --- /dev/null +++ b/login.sh @@ -0,0 +1,28 @@ +#!/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 .success) +#check if login was success +if [ "$LOGIN" = "true" ] + then + #Requesting for User profile after login and regex to grap the Full name + NAME=$(curl -s -b $COOKIE $BML_URL/profile \ + | awk -F 'fullname":"' '{print $2}' \ + | cut -f1 -d '"') + #display a Welcome message with fullname + echo "" + echo ${green}Welcome ${reset}$NAME +# curl -s -b $COOKIE $BML_URL/userinfo + echo "" + source mainmenu.sh +else + #Display error if login was not succuessfull and delete cookie + echo "${red}An error occured, Please check Username and Password" 1>&2 + rm $COOKIE 2> /dev/null + exit +fi + + diff --git a/mainmenu.sh b/mainmenu.sh index bf63e80..f5ee665 100644 --- a/mainmenu.sh +++ b/mainmenu.sh @@ -1,4 +1,4 @@ -echo "Menu" +echo "Main Menu" echo "" echo "1 - Accounts" echo "2 - Transfer" diff --git a/password.sh b/password.sh new file mode 100644 index 0000000..d1f65ea --- /dev/null +++ b/password.sh @@ -0,0 +1,34 @@ +#!/bin/bash + + +#importing saved credentials +source .env 2> /dev/null + +#what to do if credentials not saved +if [ "$BML_USERNAME" = "" ] +then + echo ${red}Credentials not found in .env file${reset} + echo "" + read -p 'Username: ' BML_USERNAME + read -s -p 'Password: ' BML_PASSWORD + echo "" + echo "Do ${red}NOT${reset} save password if password contain '|' '^' '$' '&' ';' ':' '(' ')' " + read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN + + if [ "$SAVE_LOGIN" = "Y" ] + then + echo BML_USERNAME=$BML_USERNAME > .env + echo BML_PASSWORD=$BML_PASSWORD >> .env + elif [ "$SAVE_LOGIN" = "y" ] + then + echo BML_USERNAME=$BML_USERNAME > .env + echo BML_PASSWORD=$BML_PASSWORD >> .env + else + : + fi + echo "" +else + : +fi + +source login.sh -- 2.47.2 From d9f84b6808fdb2e1358c0c03ab2e2557b9b97861 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 02:25:58 +0500 Subject: [PATCH 014/133] added support for space when adding contact --- addcontact-bml.sh | 11 +++++++++-- install.sh | 0 2 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 install.sh diff --git a/addcontact-bml.sh b/addcontact-bml.sh index 4c18261..7acc357 100644 --- a/addcontact-bml.sh +++ b/addcontact-bml.sh @@ -8,15 +8,22 @@ VALID_NUMBER=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ if [ "$VALID_NUMBER" = "true" ] then - NAME=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ + 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: $NAME" + 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 \ diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 -- 2.47.2 From fd0452962097e177ee9182a9dc6a56744f732a4b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 06:24:11 +0500 Subject: [PATCH 015/133] Added Account locked, more detailed errors --- bml.sh | 3 ++- login.sh | 29 +++++++++++++---------------- readpass.sh | 29 +++++++++++++++++++++++++++++ savepass.sh | 27 +++++++++++++++++++++++++++ welcome.sh | 11 +++++++++++ 5 files changed, 82 insertions(+), 17 deletions(-) create mode 100644 readpass.sh create mode 100644 savepass.sh create mode 100644 welcome.sh diff --git a/bml.sh b/bml.sh index e687e3e..cf5b5eb 100755 --- a/bml.sh +++ b/bml.sh @@ -5,6 +5,7 @@ #Setting intial variables BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' COOKIE=/tmp/bmlcookie +CREDENTIALS=.env #Setting terminal output colors red=`tput setaf 1` @@ -12,4 +13,4 @@ green=`tput setaf 2` reset=`tput sgr0` -source password.sh +source readpass.sh diff --git a/login.sh b/login.sh index 58c7d0c..8d8a54d 100644 --- a/login.sh +++ b/login.sh @@ -1,28 +1,25 @@ #!/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 .success) + | jq -r .code) #check if login was success -if [ "$LOGIN" = "true" ] +if [ "$LOGIN" = "0" ] then - #Requesting for User profile after login and regex to grap the Full name - NAME=$(curl -s -b $COOKIE $BML_URL/profile \ - | awk -F 'fullname":"' '{print $2}' \ - | cut -f1 -d '"') - #display a Welcome message with fullname - echo "" - echo ${green}Welcome ${reset}$NAME -# curl -s -b $COOKIE $BML_URL/userinfo - echo "" - source mainmenu.sh + source savepass.sh +elif [ "$LOGIN" = "20" ] + then + echo "${red}Account Locked!${reset}" + exit +elif [ "$LOGIN" = "2" ] + then + source readpass.sh else - #Display error if login was not succuessfull and delete cookie - echo "${red}An error occured, Please check Username and Password" 1>&2 - rm $COOKIE 2> /dev/null - exit + echo "${red}Unknown Error${reset}" 1>&2 + exit fi diff --git a/readpass.sh b/readpass.sh new file mode 100644 index 0000000..1354fa6 --- /dev/null +++ b/readpass.sh @@ -0,0 +1,29 @@ + +if [ -f $CREDENTIALS ] +then + source $CREDENTIALS +elif [ "$LOGIN" = "2" ] +then + if [ -f $CREDENTIALS ] + then + echo "${red}Saved Credentials has been changed${reset}" + rm $CREDENTIALS + else + echo "${red}Username or Password incorrect${reset}" + fi + read -p 'Username: ' BML_USERNAME + read -s -p 'Password: ' BML_PASSWORD + echo "" + +elif [ ! -f $CREDENTIALS ] +then + echo "${red}Password file not found in $CREDENTIALS${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 new file mode 100644 index 0000000..15e1d09 --- /dev/null +++ b/savepass.sh @@ -0,0 +1,27 @@ +#echo "Do ${red}NOT${reset} save password if password contain '|' '^' '$' '&' ';' ':' '(' ')' " + +if [ ! -f $CREDENTIALS ] +then + if [ "$LOGIN" = "0" ] + then + read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN + if [ "$SAVE_LOGIN" = "Y" ] + then + echo BML_USERNAME=''${BML_USERNAME}'' > $CREDENTIALS + echo BML_PASSWORD=''${BML_PASSWORD}'' >> $CREDENTIALS + + elif [ "$SAVE_LOGIN" = "y" ] + then + echo BML_USERNAME=''${BML_USERNAME}'' > $CREDENTIALS + echo BML_PASSWORD=''${BML_PASSWORD}'' >> $CREDENTIALS + else + : + fi + else + source readpass.sh + fi +else + : +fi + +source welcome.sh diff --git a/welcome.sh b/welcome.sh new file mode 100644 index 0000000..e18bfc7 --- /dev/null +++ b/welcome.sh @@ -0,0 +1,11 @@ +#Requesting for User profile after login and regex to grap the Full name +NAME=$(curl -s -b $COOKIE $BML_URL/profile \ + | awk -F 'fullname":"' '{print $2}' \ + | cut -f1 -d '"') + +#display a Welcome message with fullname +echo "" +echo ${green}Welcome ${reset}$NAME +#curl -s -b $COOKIE $BML_URL/userinfo +echo "" +source mainmenu.sh -- 2.47.2 From 57a41ac82b8527a804e50a38d600589285679f32 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 06:26:21 +0500 Subject: [PATCH 016/133] delete old code --- password.sh | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 password.sh diff --git a/password.sh b/password.sh deleted file mode 100644 index d1f65ea..0000000 --- a/password.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - - -#importing saved credentials -source .env 2> /dev/null - -#what to do if credentials not saved -if [ "$BML_USERNAME" = "" ] -then - echo ${red}Credentials not found in .env file${reset} - echo "" - read -p 'Username: ' BML_USERNAME - read -s -p 'Password: ' BML_PASSWORD - echo "" - echo "Do ${red}NOT${reset} save password if password contain '|' '^' '$' '&' ';' ':' '(' ')' " - read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN - - if [ "$SAVE_LOGIN" = "Y" ] - then - echo BML_USERNAME=$BML_USERNAME > .env - echo BML_PASSWORD=$BML_PASSWORD >> .env - elif [ "$SAVE_LOGIN" = "y" ] - then - echo BML_USERNAME=$BML_USERNAME > .env - echo BML_PASSWORD=$BML_PASSWORD >> .env - else - : - fi - echo "" -else - : -fi - -source login.sh -- 2.47.2 From 5d44df595bbe5fca31107eae3b7c20a4c2b38b3e Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 06:45:24 +0500 Subject: [PATCH 017/133] 'fix $ in password' --- savepass.sh | 8 ++++---- welcome.sh | 22 ++++++++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/savepass.sh b/savepass.sh index 15e1d09..c376487 100644 --- a/savepass.sh +++ b/savepass.sh @@ -7,13 +7,13 @@ then read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN if [ "$SAVE_LOGIN" = "Y" ] then - echo BML_USERNAME=''${BML_USERNAME}'' > $CREDENTIALS - echo BML_PASSWORD=''${BML_PASSWORD}'' >> $CREDENTIALS + echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS + echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS elif [ "$SAVE_LOGIN" = "y" ] then - echo BML_USERNAME=''${BML_USERNAME}'' > $CREDENTIALS - echo BML_PASSWORD=''${BML_PASSWORD}'' >> $CREDENTIALS + echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS + echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS else : fi diff --git a/welcome.sh b/welcome.sh index e18bfc7..47c0cf2 100644 --- a/welcome.sh +++ b/welcome.sh @@ -1,11 +1,25 @@ #Requesting for User profile after login and regex to grap the Full name -NAME=$(curl -s -b $COOKIE $BML_URL/profile \ - | awk -F 'fullname":"' '{print $2}' \ - | cut -f1 -d '"') +curl -s -b $COOKIE $BML_URL/profile > /dev/null + +NAME=$(curl -s -b $COOKIE $BML_URL/userinfo \ + | jq -r '.["payload"] | .["user"] | .fullname') +PHONE=$(curl -s -b $COOKIE $BML_URL/userinfo \ + | jq -r '.["payload"] | .["user"] | .mobile_phone') +EMAIL=$(curl -s -b $COOKIE $BML_URL/userinfo \ + | jq -r '.["payload"] | .["user"] | .email') +DOB=$(curl -s -b $COOKIE $BML_URL/userinfo \ + | jq -r '.["payload"] | .["user"] | .birthdate') +# | cut -f1 -d 'T' ) +IDCARD=$(curl -s -b $COOKIE $BML_URL/userinfo \ + | jq -r '.["payload"] | .["user"] | .idcard') #display a Welcome message with fullname echo "" echo ${green}Welcome ${reset}$NAME -#curl -s -b $COOKIE $BML_URL/userinfo +echo "" +echo Phone: $PHONE +echo Email: $EMAIL +echo Birthday: $DOB +echo ID Card: $IDCARD echo "" source mainmenu.sh -- 2.47.2 From 87fdd64328ce3e2c77f8b0014f8312782fa53946 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 07:15:26 +0500 Subject: [PATCH 018/133] password saving --- readpass.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/readpass.sh b/readpass.sh index 1354fa6..ee40614 100644 --- a/readpass.sh +++ b/readpass.sh @@ -1,23 +1,19 @@ - if [ -f $CREDENTIALS ] then source $CREDENTIALS -elif [ "$LOGIN" = "2" ] -then - if [ -f $CREDENTIALS ] + if [ "$LOGIN" = "2" ] then - echo "${red}Saved Credentials has been changed${reset}" - rm $CREDENTIALS + echo "${red}Password update required${reset}" + rm $CREDENTIALS 2> /dev/null + read -p 'Username: ' BML_USERNAME + read -s -p 'Password: ' BML_PASSWORD + echo "" else - echo "${red}Username or Password incorrect${reset}" + : fi - read -p 'Username: ' BML_USERNAME - read -s -p 'Password: ' BML_PASSWORD - echo "" - elif [ ! -f $CREDENTIALS ] then - echo "${red}Password file not found in $CREDENTIALS${reset}" + echo "${red}Username or Password in correct${reset}" read -p 'Username: ' BML_USERNAME read -s -p 'Password: ' BML_PASSWORD echo "" @@ -25,5 +21,4 @@ else : fi - source login.sh -- 2.47.2 From b5e38826179657984d8cac0639fb8688e8f43ed7 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 07:23:55 +0500 Subject: [PATCH 019/133] added WIP --- contactsmenu.sh | 8 +++++++- mainmenu.sh | 21 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/contactsmenu.sh b/contactsmenu.sh index 773ec28..d6c66c4 100644 --- a/contactsmenu.sh +++ b/contactsmenu.sh @@ -12,12 +12,18 @@ read -r CONTATCS if [ "$CONTATCS" = "1" ] then + echo "WIP" + sleep 2 + source conactsmenu.sh source listcontacts.sh elif [ "$CONTATCS" = "2" ] then source addcontact-menu.sh elif [ "$CONTATCS" = "3" ] then + echo "WIP" + sleep 2 + source conactsmenu.sh source delete contact.sh elif [ "$CONTATCS" = "4" ] then @@ -28,7 +34,7 @@ elif [ "$CONTATCS" = "5" ] echo "Cleaning up.." exit else - clear + echo "${red}There was an error${reset}" 1>&2 source contactsmenu.sh fi diff --git a/mainmenu.sh b/mainmenu.sh index f5ee665..8e19b9e 100644 --- a/mainmenu.sh +++ b/mainmenu.sh @@ -13,21 +13,36 @@ read -r MENU if [ "$MENU" = "1" ] then - source accounts.sh + echo "WIP" + sleep 2 + source mainmenu.sh + #source accounts.sh elif [ "$MENU" = "2" ] then - source transfer.sh + 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 + echo "WIP" + sleep 2 + source mainmenu.sh source settingsmenu.sh elif [ "$MENU" = "7" ] then @@ -35,6 +50,6 @@ elif [ "$MENU" = "7" ] exit else echo "${red}There was an error${reset}" 1>&2 - clear + source mainmenu.sh fi -- 2.47.2 From d9e5d73c07bc1883ce5d935230b6552569e8fc87 Mon Sep 17 00:00:00 2001 From: Mohamed Arham Date: Wed, 28 Apr 2021 14:39:33 +0500 Subject: [PATCH 020/133] - Add screenshot --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f72bc71..79f0342 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Bank of Maldives CLI BML CLI written in Bash. This project is currently under development and a lot of things are broken. +![photo_2021-04-28_14-36-47](https://user-images.githubusercontent.com/18140039/116382279-2dc8dd80-a82f-11eb-97ea-a864016cc032.jpg) + + ## Requiments `curl` `jq` @@ -34,4 +37,4 @@ chmod +x bml.sh ``` chmod +x install.sh ./install.sh -``` \ No newline at end of file +``` -- 2.47.2 From 7ad309eb77474afc69b474df728096dfd941e29b Mon Sep 17 00:00:00 2001 From: Mohamed Arham Date: Wed, 28 Apr 2021 14:47:58 +0500 Subject: [PATCH 021/133] - Ascii art for welcome screen - I did not test this, I take no responsibility for broken ascii art. --- welcome.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/welcome.sh b/welcome.sh index 47c0cf2..7928c8d 100644 --- a/welcome.sh +++ b/welcome.sh @@ -15,6 +15,13 @@ IDCARD=$(curl -s -b $COOKIE $BML_URL/userinfo \ #display a Welcome message with fullname echo "" +echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" +echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" +echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" +echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" +echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" +echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" +echo "" echo ${green}Welcome ${reset}$NAME echo "" echo Phone: $PHONE -- 2.47.2 From f113f6e087f92cc71ef1e389dd1deb154f3eebf3 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 14:54:45 +0500 Subject: [PATCH 022/133] RED WELCOME --- welcome.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/welcome.sh b/welcome.sh index 7928c8d..fb73e01 100644 --- a/welcome.sh +++ b/welcome.sh @@ -14,14 +14,14 @@ IDCARD=$(curl -s -b $COOKIE $BML_URL/userinfo \ | jq -r '.["payload"] | .["user"] | .idcard') #display a Welcome message with fullname -echo "" +echo "${red}" echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" -echo "" +echo "${reset}" echo ${green}Welcome ${reset}$NAME echo "" echo Phone: $PHONE -- 2.47.2 From 55c2476a0e57c1c7aa5cfa157617799a97be54ff Mon Sep 17 00:00:00 2001 From: Mohamed Arham Date: Wed, 28 Apr 2021 15:00:06 +0500 Subject: [PATCH 023/133] - Update screenshot --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 79f0342..eb2da5f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # Bank of Maldives CLI BML CLI written in Bash. This project is currently under development and a lot of things are broken. -![photo_2021-04-28_14-36-47](https://user-images.githubusercontent.com/18140039/116382279-2dc8dd80-a82f-11eb-97ea-a864016cc032.jpg) - +![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) ## Requiments `curl` `jq` -- 2.47.2 From 94d4f9544870a115d72e74744823c774fc674997 Mon Sep 17 00:00:00 2001 From: dharisd Date: Wed, 28 Apr 2021 03:21:18 -0700 Subject: [PATCH 024/133] fix typo in readme and fix format --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eb2da5f..055935e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ BML CLI written in Bash. This project is currently under development and a lot o ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) -## Requiments +# Requirements `curl` `jq` ### Ubuntu @@ -20,9 +20,9 @@ BML CLI written in Bash. This project is currently under development and a lot o - Do **NOT** save passwords that contain one of the following characters ` | ^ $ & ; : ( )` -## Installation +# Installation -### Recommended +## Recommended ``` git clone https://github.com/shihaamabr/bml-cli @@ -32,7 +32,7 @@ chmod +x bml.sh ./bml.sh ``` -### Not Recommended +## Not Recommended ``` chmod +x install.sh ./install.sh -- 2.47.2 From 9df205e8624209f45121ef5631ac62dd1c33616b Mon Sep 17 00:00:00 2001 From: dharisd Date: Wed, 28 Apr 2021 03:22:04 -0700 Subject: [PATCH 025/133] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 055935e..238237a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ BML CLI written in Bash. This project is currently under development and a lot o ### Arch `sudo pacman -S curl jq` -## Bugs +# Bugs - Colored texts do not work in Termux - Do **NOT** save passwords that contain one of the following characters ` | ^ $ & ; : ( )` -- 2.47.2 From 48ab31e820d3535c513c98d481cae4e29acc3630 Mon Sep 17 00:00:00 2001 From: dharisd Date: Wed, 28 Apr 2021 03:23:14 -0700 Subject: [PATCH 026/133] fix format --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 238237a..e5820b7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ BML CLI written in Bash. This project is currently under development and a lot o # Installation -## Recommended +### Recommended ``` git clone https://github.com/shihaamabr/bml-cli @@ -32,7 +32,7 @@ chmod +x bml.sh ./bml.sh ``` -## Not Recommended +### Not Recommended ``` chmod +x install.sh ./install.sh -- 2.47.2 From 2b09a272508c3202740f3a294da6c8759d86d7b2 Mon Sep 17 00:00:00 2001 From: dharisd Date: Wed, 28 Apr 2021 03:33:41 -0700 Subject: [PATCH 027/133] fix formatting --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e5820b7..2c58213 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ BML CLI written in Bash. This project is currently under development and a lot o ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) -# Requirements +## Requirements `curl` `jq` ### Ubuntu @@ -20,7 +20,7 @@ BML CLI written in Bash. This project is currently under development and a lot o - Do **NOT** save passwords that contain one of the following characters ` | ^ $ & ; : ( )` -# Installation +## Installation ### Recommended ``` -- 2.47.2 From cfcd7f1bf6c3eb831bc908b3edd4ff0525bf7c8b Mon Sep 17 00:00:00 2001 From: dharisd Date: Wed, 28 Apr 2021 03:34:21 -0700 Subject: [PATCH 028/133] fix format --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c58213..6a0a4c3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ BML CLI written in Bash. This project is currently under development and a lot o ### Arch `sudo pacman -S curl jq` -# Bugs +## Bugs - Colored texts do not work in Termux - Do **NOT** save passwords that contain one of the following characters ` | ^ $ & ; : ( )` -- 2.47.2 From d7f4b0efbc64b9008daad364aa69cf89e66a2da2 Mon Sep 17 00:00:00 2001 From: dharisd Date: Wed, 28 Apr 2021 03:38:47 -0700 Subject: [PATCH 029/133] my ocd is more happy when its like this --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6a0a4c3..56b025b 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ BML CLI written in Bash. This project is currently under development and a lot o ## Requirements `curl` `jq` -### Ubuntu +**Ubuntu** `sudo apt install curl jq` -### Fedora +**Fedora** `sudo dnf install curl jq` -### Arch +**Arch** `sudo pacman -S curl jq` ## Bugs @@ -22,7 +22,7 @@ BML CLI written in Bash. This project is currently under development and a lot o ## Installation -### Recommended +**Recommended** ``` git clone https://github.com/shihaamabr/bml-cli @@ -32,7 +32,8 @@ chmod +x bml.sh ./bml.sh ``` -### Not Recommended +**Not Recommended** + ``` chmod +x install.sh ./install.sh -- 2.47.2 From c506d2a5e49779dd5c55f56b885c5c2e1a3d4d67 Mon Sep 17 00:00:00 2001 From: dharisd Date: Wed, 28 Apr 2021 03:49:57 -0700 Subject: [PATCH 030/133] better formatting --- README.md | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 56b025b..38ac03c 100644 --- a/README.md +++ b/README.md @@ -2,39 +2,39 @@ BML CLI written in Bash. This project is currently under development and a lot of things are broken. ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) - + ## Requirements -`curl` `jq` + `curl` `jq` -**Ubuntu** -`sudo apt install curl jq` +#### Ubuntu + `sudo apt install curl jq` -**Fedora** -`sudo dnf install curl jq` +#### Fedora + `sudo dnf install curl jq` -**Arch** -`sudo pacman -S curl jq` +#### Arch + `sudo pacman -S curl jq` ## Bugs -- Colored texts do not work in Termux -- Do **NOT** save passwords that contain one of the following characters -` | ^ $ & ; : ( )` + - Colored texts do not work in Termux + - Do **NOT** save passwords that contain one of the following characters + ` | ^ $ & ; : ( )` ## Installation **Recommended** -``` -git clone https://github.com/shihaamabr/bml-cli - -cd bml-cli - -chmod +x bml.sh -./bml.sh -``` + ``` + git clone https://github.com/shihaamabr/bml-cli + + cd bml-cli + + chmod +x bml.sh + ./bml.sh + ``` **Not Recommended** - -``` -chmod +x install.sh -./install.sh -``` + + ``` + chmod +x install.sh + ./install.sh + ``` -- 2.47.2 From 239df633ad0605cf66a14175e3538ba8111fc2ad Mon Sep 17 00:00:00 2001 From: Athfan Khaleel Date: Wed, 28 Apr 2021 16:20:46 +0500 Subject: [PATCH 031/133] install.sh go bye bye --- install.sh | 1 - 1 file changed, 1 deletion(-) delete mode 100755 install.sh diff --git a/install.sh b/install.sh deleted file mode 100755 index 46301d0..0000000 --- a/install.sh +++ /dev/null @@ -1 +0,0 @@ -curl -sL "https://raw.githubusercontent.com/shihaamabr/bml-cli/main/bml.sh" | sudo tee /usr/bin/bml-cli >/dev/null && sudo chmod 755 /usr/bin/bml-cli \ No newline at end of file -- 2.47.2 From db33689de68c4ce8f4300438bccc710cc8a45df1 Mon Sep 17 00:00:00 2001 From: Athfan Khaleel Date: Wed, 28 Apr 2021 16:35:58 +0500 Subject: [PATCH 032/133] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index e5820b7..f33df56 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,4 @@ chmod +x bml.sh ./bml.sh ``` -### Not Recommended -``` -chmod +x install.sh -./install.sh -``` + -- 2.47.2 From 20afc3e1c135423237eb29e9c35fad0e232f9705 Mon Sep 17 00:00:00 2001 From: Athfan Khaleel Date: Wed, 28 Apr 2021 16:37:52 +0500 Subject: [PATCH 033/133] Does this fix the merge issue? --- README.md | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index f33df56..8852008 100644 --- a/README.md +++ b/README.md @@ -2,34 +2,32 @@ BML CLI written in Bash. This project is currently under development and a lot of things are broken. ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) + +## Requirements + `curl` `jq` -# Requirements -`curl` `jq` +#### Ubuntu + `sudo apt install curl jq` -### Ubuntu -`sudo apt install curl jq` +#### Fedora + `sudo dnf install curl jq` -### Fedora -`sudo dnf install curl jq` +#### Arch + `sudo pacman -S curl jq` -### Arch -`sudo pacman -S curl jq` - -# Bugs -- Colored texts do not work in Termux -- Do **NOT** save passwords that contain one of the following characters -` | ^ $ & ; : ( )` - -# Installation - -### Recommended -``` -git clone https://github.com/shihaamabr/bml-cli - -cd bml-cli - -chmod +x bml.sh -./bml.sh -``` +## Bugs + - Colored texts do not work in Termux + - Do **NOT** save passwords that contain one of the following characters + ` | ^ $ & ; : ( )` +## Installation +**Recommended** + ``` + git clone https://github.com/shihaamabr/bml-cli + + cd bml-cli + + chmod +x bml.sh + ./bml.sh + ``` -- 2.47.2 From 6862fe1a559a4ad319b21ca5e8fbb7f493c86a88 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 16:41:35 +0500 Subject: [PATCH 034/133] Revert "I think im happy now" --- README.md | 57 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 38ac03c..e5820b7 100644 --- a/README.md +++ b/README.md @@ -2,39 +2,38 @@ BML CLI written in Bash. This project is currently under development and a lot of things are broken. ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) - -## Requirements - `curl` `jq` -#### Ubuntu - `sudo apt install curl jq` +# Requirements +`curl` `jq` -#### Fedora - `sudo dnf install curl jq` +### Ubuntu +`sudo apt install curl jq` -#### Arch - `sudo pacman -S curl jq` +### Fedora +`sudo dnf install curl jq` -## Bugs - - Colored texts do not work in Termux - - Do **NOT** save passwords that contain one of the following characters - ` | ^ $ & ; : ( )` +### Arch +`sudo pacman -S curl jq` -## Installation +# Bugs +- Colored texts do not work in Termux +- Do **NOT** save passwords that contain one of the following characters +` | ^ $ & ; : ( )` -**Recommended** - ``` - git clone https://github.com/shihaamabr/bml-cli - - cd bml-cli - - chmod +x bml.sh - ./bml.sh - ``` +# Installation -**Not Recommended** - - ``` - chmod +x install.sh - ./install.sh - ``` +### Recommended +``` +git clone https://github.com/shihaamabr/bml-cli + +cd bml-cli + +chmod +x bml.sh +./bml.sh +``` + +### Not Recommended +``` +chmod +x install.sh +./install.sh +``` -- 2.47.2 From 0c80def5d0c7812d50f99b7f3cf5c15ce4e51377 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 16:53:43 +0500 Subject: [PATCH 035/133] readme --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8852008..e6d80b3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,12 @@ BML CLI written in Bash. This project is currently under development and a lot o ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) ## Requirements - `curl` `jq` + + - Make sure all requirements are met before running script. + `curl` `jq` + +#### Arch + `sudo pacman -S curl jq` #### Ubuntu `sudo apt install curl jq` @@ -17,12 +22,8 @@ BML CLI written in Bash. This project is currently under development and a lot o ## Bugs - Colored texts do not work in Termux - - Do **NOT** save passwords that contain one of the following characters - ` | ^ $ & ; : ( )` ## Installation - -**Recommended** ``` git clone https://github.com/shihaamabr/bml-cli -- 2.47.2 From 3f3ecfe2aa00fc9ebf10c26d74698ae7e8705855 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 16:56:59 +0500 Subject: [PATCH 036/133] whotf fucked up readme fixed readme --- README.md | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index e6d80b3..987eeca 100644 --- a/README.md +++ b/README.md @@ -3,32 +3,26 @@ BML CLI written in Bash. This project is currently under development and a lot o ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) -## Requirements +## Requirements +`curl` `jq` +- Make sure all requirements are met before running script. - - Make sure all requirements are met before running script. - `curl` `jq` - -#### Arch - `sudo pacman -S curl jq` +#### Arch Linux +`sudo pacman -S curl jq` #### Ubuntu - `sudo apt install curl jq` +`sudo apt install curl jq` #### Fedora - `sudo dnf install curl jq` - -#### Arch - `sudo pacman -S curl jq` +`sudo dnf install curl jq` ## Bugs - - Colored texts do not work in Termux +- Colored texts do not work in Termux ## Installation - ``` - git clone https://github.com/shihaamabr/bml-cli - - cd bml-cli - - chmod +x bml.sh - ./bml.sh - ``` +``` +git clone https://github.com/shihaamabr/bml-cli +cd bml-cli +chmod +x bml.sh +./bml.sh +``` -- 2.47.2 From 6c982f94cc8b6011b6a971a79af1bc11312827d6 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 18:08:43 +0500 Subject: [PATCH 037/133] Added support for Delete Contact --- contactsmenu.sh | 8 +------- deletecontact.sh | 17 +++++++++++++++++ listcontacts.sh | 2 +- readpass.sh | 4 ++-- 4 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 deletecontact.sh diff --git a/contactsmenu.sh b/contactsmenu.sh index d6c66c4..3cfbf63 100644 --- a/contactsmenu.sh +++ b/contactsmenu.sh @@ -12,19 +12,13 @@ read -r CONTATCS if [ "$CONTATCS" = "1" ] then - echo "WIP" - sleep 2 - source conactsmenu.sh source listcontacts.sh elif [ "$CONTATCS" = "2" ] then source addcontact-menu.sh elif [ "$CONTATCS" = "3" ] then - echo "WIP" - sleep 2 - source conactsmenu.sh - source delete contact.sh + source deletecontact.sh elif [ "$CONTATCS" = "4" ] then source mainmenu.sh diff --git a/deletecontact.sh b/deletecontact.sh new file mode 100644 index 0000000..e756199 --- /dev/null +++ b/deletecontact.sh @@ -0,0 +1,17 @@ + + +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/listcontacts.sh b/listcontacts.sh index f517801..ec58136 100644 --- a/listcontacts.sh +++ b/listcontacts.sh @@ -1,3 +1,3 @@ curl -s -b $COOKIE $BML_URL/contacts \ -| jq -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' +| jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' source contactsmenu.sh diff --git a/readpass.sh b/readpass.sh index ee40614..4166da6 100644 --- a/readpass.sh +++ b/readpass.sh @@ -3,7 +3,7 @@ then source $CREDENTIALS if [ "$LOGIN" = "2" ] then - echo "${red}Password update required${reset}" + echo "${red}Login Required${reset}" rm $CREDENTIALS 2> /dev/null read -p 'Username: ' BML_USERNAME read -s -p 'Password: ' BML_PASSWORD @@ -13,7 +13,7 @@ then fi elif [ ! -f $CREDENTIALS ] then - echo "${red}Username or Password in correct${reset}" + echo "${red}Login Required${reset}" read -p 'Username: ' BML_USERNAME read -s -p 'Password: ' BML_PASSWORD echo "" -- 2.47.2 From 5844e8c712e421a29dc5b4b464c4c3d5e32ba36c Mon Sep 17 00:00:00 2001 From: Mohamed Arham Date: Wed, 28 Apr 2021 18:33:24 +0500 Subject: [PATCH 038/133] - Update terminal colors - Fixes color break in Termux --- bml.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bml.sh b/bml.sh index cf5b5eb..09271d0 100755 --- a/bml.sh +++ b/bml.sh @@ -8,9 +8,8 @@ COOKIE=/tmp/bmlcookie CREDENTIALS=.env #Setting terminal output colors -red=`tput setaf 1` -green=`tput setaf 2` -reset=`tput sgr0` - +red="\033[0;32m" +green="\033[0;31m" +reset="\033[0m" source readpass.sh -- 2.47.2 From 9d1fff3e5198ffeca4561da9d25c28a17d74d867 Mon Sep 17 00:00:00 2001 From: Mohamed Arham Date: Wed, 28 Apr 2021 18:38:54 +0500 Subject: [PATCH 039/133] - Testing is not for me --- bml.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bml.sh b/bml.sh index 09271d0..9bccf30 100755 --- a/bml.sh +++ b/bml.sh @@ -8,8 +8,8 @@ COOKIE=/tmp/bmlcookie CREDENTIALS=.env #Setting terminal output colors -red="\033[0;32m" -green="\033[0;31m" -reset="\033[0m" +red= `\033[0;32m` +green= `\033[0;31m` +reset= `\033[0m` source readpass.sh -- 2.47.2 From ba37a5019c1be1b84ed915ff2908086c53938d0e Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 19:14:39 +0500 Subject: [PATCH 040/133] Revert "- Testing is not for me" --- bml.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bml.sh b/bml.sh index 9bccf30..09271d0 100755 --- a/bml.sh +++ b/bml.sh @@ -8,8 +8,8 @@ COOKIE=/tmp/bmlcookie CREDENTIALS=.env #Setting terminal output colors -red= `\033[0;32m` -green= `\033[0;31m` -reset= `\033[0m` +red="\033[0;32m" +green="\033[0;31m" +reset="\033[0m" source readpass.sh -- 2.47.2 From 82a7e1012b98b8573811718d5b37366d297e6f8a Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 19:15:19 +0500 Subject: [PATCH 041/133] Revert "- Update terminal colors" --- bml.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bml.sh b/bml.sh index 09271d0..cf5b5eb 100755 --- a/bml.sh +++ b/bml.sh @@ -8,8 +8,9 @@ COOKIE=/tmp/bmlcookie CREDENTIALS=.env #Setting terminal output colors -red="\033[0;32m" -green="\033[0;31m" -reset="\033[0m" +red=`tput setaf 1` +green=`tput setaf 2` +reset=`tput sgr0` + source readpass.sh -- 2.47.2 From 307242216be33ad9c1585af6819f8a4c70289c99 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 19:18:59 +0500 Subject: [PATCH 042/133] Add More Colors --- bml.sh | 9 +++++++++ welcome.sh | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bml.sh b/bml.sh index cf5b5eb..3c53924 100755 --- a/bml.sh +++ b/bml.sh @@ -10,6 +10,15 @@ CREDENTIALS=.env #Setting terminal output colors red=`tput setaf 1` green=`tput setaf 2` +brown=`tput setaf 3` +blue=`tput setaf 4` +pink=`tput setaf 5` +cyan=`tput setaf 6` +gray=`tput setaf 7` +darkgray=`tput setaf 8` +lightred=`tput setaf 9` +lightgreen=`tput setaf 10` +yellow=`tput setaf 11` reset=`tput sgr0` diff --git a/welcome.sh b/welcome.sh index fb73e01..db3b56d 100644 --- a/welcome.sh +++ b/welcome.sh @@ -24,9 +24,9 @@ echo "╚═════╝░╚═╝░░░░░╚═╝╚════ echo "${reset}" echo ${green}Welcome ${reset}$NAME echo "" -echo Phone: $PHONE -echo Email: $EMAIL -echo Birthday: $DOB -echo ID Card: $IDCARD +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 -- 2.47.2 From 03cc4ecf48d0b54360d6b0184f2633a9bc9d111c Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 19:26:27 +0500 Subject: [PATCH 043/133] termux users color readme --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 987eeca..dc21e47 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ BML CLI written in Bash. This project is currently under development and a lot o ## Requirements `curl` `jq` - Make sure all requirements are met before running script. +- Termux users will need `ncurses-utils` additionally for terminal colors #### Arch Linux `sudo pacman -S curl jq` @@ -16,8 +17,11 @@ BML CLI written in Bash. This project is currently under development and a lot o #### Fedora `sudo dnf install curl jq` +### Termux +`pkg install curl jq ncurses-utils` + ## Bugs -- Colored texts do not work in Termux +- :) ## Installation ``` -- 2.47.2 From 88867b09357dda3b8b9b92f2a0fedb5f3a1dbe99 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 19:32:47 +0500 Subject: [PATCH 044/133] changed cookie and env dir to home --- bml.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bml.sh b/bml.sh index 3c53924..2371ca5 100755 --- a/bml.sh +++ b/bml.sh @@ -4,8 +4,11 @@ #Setting intial variables BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' -COOKIE=/tmp/bmlcookie -CREDENTIALS=.env +mkdir -p ~/.config/bml-cli/ +mkdir -p ~/.cache/bml-cli/ + +COOKIE=~/.cache/bml-cli/cookie +CREDENTIALS=~/.config/bml-cli/.env #Setting terminal output colors red=`tput setaf 1` -- 2.47.2 From 6e9d3cdd415dbd8ef58f05d26a1df938280a0468 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 19:42:43 +0500 Subject: [PATCH 045/133] save password location with warning --- bml.sh | 7 +++---- savepass.sh | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bml.sh b/bml.sh index 2371ca5..b51a5ad 100755 --- a/bml.sh +++ b/bml.sh @@ -1,12 +1,11 @@ #!/bin/bash - - -#Setting intial variables -BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' +#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' COOKIE=~/.cache/bml-cli/cookie CREDENTIALS=~/.config/bml-cli/.env diff --git a/savepass.sh b/savepass.sh index c376487..b5bfbfc 100644 --- a/savepass.sh +++ b/savepass.sh @@ -7,11 +7,13 @@ then read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN if [ "$SAVE_LOGIN" = "Y" ] then + echo "Username and Password is saved in ${lightred}PAIN TEXT${reset} in $CREDENTIALS" echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS elif [ "$SAVE_LOGIN" = "y" ] then + echo "Username and Password is saved in ${lightred}PAIN TEXT${reset} in $CREDENTIALS" echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS else -- 2.47.2 From 6a7bad01f7766dad1dd8056e7ad06154f228ad88 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 00:42:32 +0500 Subject: [PATCH 046/133] Removed WSL Support --- bml.sh | 11 +++++++++++ logout.sh | 1 + settings.sh.save | 18 ++++++++++++++++++ settings.sh.save.1 | 18 ++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 logout.sh create mode 100644 settings.sh.save create mode 100644 settings.sh.save.1 diff --git a/bml.sh b/bml.sh index b51a5ad..3a9ac77 100755 --- a/bml.sh +++ b/bml.sh @@ -24,4 +24,15 @@ yellow=`tput setaf 11` reset=`tput sgr0` +OS=$(uname -r | grep -oE microsoft) +if [ "$OS" = "microsoft" ] +then + echo "${red}WSL Not Supported!${reset}" + exit +else + : +fi + + + source readpass.sh diff --git a/logout.sh b/logout.sh new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/logout.sh @@ -0,0 +1 @@ + diff --git a/settings.sh.save b/settings.sh.save new file mode 100644 index 0000000..2fdea16 --- /dev/null +++ b/settings.sh.save @@ -0,0 +1,18 @@ + + + + + +curl 'https://www.bankofmaldives.com.mv/internetbanking/api/user/setting' \ + -H 'authority: www.bankofmaldives.com.mv' \ + -H 'pragma: no-cache' \ + -H 'cache-control: no-cache' \ + -H 'accept: application/json, text/plain, */*' \ + -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36' \ + -H 'sec-fetch-site: same-origin' \ + -H 'sec-fetch-mode: cors' \ + -H 'sec-fetch-dest: empty' \ + -H 'referer: https://www.bankofmaldives.com.mv/internetbanking/services/applications/additional-account' \ + -H 'accept-language: en-US,en;q=0.9' \ + -H 'cookie: _ga=GA1.3.124704262.1610983104; __cfduid=db7fb4eee4148a228ab982945635908491617794172; _gid=GA1.3.416113663.1619468410; BNES_samesite=nUGtaZObWv78dkAR0E4QMJlriZV44DGffLR9DBncVIKf3l3C+4iEOoHsfmm92Y7D4MFzG9FnjLM=; BLAZEID=eyJpdiI6IjZyOEZNRVwvSXZDaVFQaGt2NmJsWnZRPT0iLCJ2YWx1ZSI6InFBSUh4THhsUnB4NDA1dFRRUm1maFpcL0I4OENYUHpzZzR4Y2d6aHhET2U5RUhoa1VwSnhvNmtRdldIdStQTnVlIiwibWFjIjoiNzA3ODU3MDFlMDJiZTg0ZTJjNzQ5ZmUzZTllZWVlYjcxY2NhNzNlNDVjNzkzOGYxNzY4ZmY0MzhjMjI5OTg3NCJ9; BNES_BLAZEID=ckZKCwsxF2HgzM+GkPbdL77qHQ9gXXuAFlz3kuDzFWiIZ1BYn0rJMz1x1meRxt4Zwf/VjgBL1WCDrFjXg1ekJU5fuTfJoeMsu1ftKoGxHjPpfTFnqgcyi/41Qw/dflmKUABUwWGV5JdjanoeULegT5JnxF7BCTeBfqCBTiWV6Fi9gBj7H1gF/6kwl3jlm3Om8dv9zfURCwsm8KcchfURtCYA1Wt9rb3y+kO/s/bPmle5cwLP4QaxWq0IwCZ6uFT4osXacvXMI4JYeSF1RR26DW4dp2rNBPzEdXT+Zt099vBCaqboH4mHvJi37iVdzcVkdKaZF2chSsiqozk2oo//TgyoqNFrU9I7aefy4ZwBOwLycH02cHqvCGcf7NOfTGsSgLMIFi7/JVU=' \ + --compressed diff --git a/settings.sh.save.1 b/settings.sh.save.1 new file mode 100644 index 0000000..2fdea16 --- /dev/null +++ b/settings.sh.save.1 @@ -0,0 +1,18 @@ + + + + + +curl 'https://www.bankofmaldives.com.mv/internetbanking/api/user/setting' \ + -H 'authority: www.bankofmaldives.com.mv' \ + -H 'pragma: no-cache' \ + -H 'cache-control: no-cache' \ + -H 'accept: application/json, text/plain, */*' \ + -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36' \ + -H 'sec-fetch-site: same-origin' \ + -H 'sec-fetch-mode: cors' \ + -H 'sec-fetch-dest: empty' \ + -H 'referer: https://www.bankofmaldives.com.mv/internetbanking/services/applications/additional-account' \ + -H 'accept-language: en-US,en;q=0.9' \ + -H 'cookie: _ga=GA1.3.124704262.1610983104; __cfduid=db7fb4eee4148a228ab982945635908491617794172; _gid=GA1.3.416113663.1619468410; BNES_samesite=nUGtaZObWv78dkAR0E4QMJlriZV44DGffLR9DBncVIKf3l3C+4iEOoHsfmm92Y7D4MFzG9FnjLM=; BLAZEID=eyJpdiI6IjZyOEZNRVwvSXZDaVFQaGt2NmJsWnZRPT0iLCJ2YWx1ZSI6InFBSUh4THhsUnB4NDA1dFRRUm1maFpcL0I4OENYUHpzZzR4Y2d6aHhET2U5RUhoa1VwSnhvNmtRdldIdStQTnVlIiwibWFjIjoiNzA3ODU3MDFlMDJiZTg0ZTJjNzQ5ZmUzZTllZWVlYjcxY2NhNzNlNDVjNzkzOGYxNzY4ZmY0MzhjMjI5OTg3NCJ9; BNES_BLAZEID=ckZKCwsxF2HgzM+GkPbdL77qHQ9gXXuAFlz3kuDzFWiIZ1BYn0rJMz1x1meRxt4Zwf/VjgBL1WCDrFjXg1ekJU5fuTfJoeMsu1ftKoGxHjPpfTFnqgcyi/41Qw/dflmKUABUwWGV5JdjanoeULegT5JnxF7BCTeBfqCBTiWV6Fi9gBj7H1gF/6kwl3jlm3Om8dv9zfURCwsm8KcchfURtCYA1Wt9rb3y+kO/s/bPmle5cwLP4QaxWq0IwCZ6uFT4osXacvXMI4JYeSF1RR26DW4dp2rNBPzEdXT+Zt099vBCaqboH4mHvJi37iVdzcVkdKaZF2chSsiqozk2oo//TgyoqNFrU9I7aefy4ZwBOwLycH02cHqvCGcf7NOfTGsSgLMIFi7/JVU=' \ + --compressed -- 2.47.2 From b2544ca4a4c4325f8e54d4890be10ea7e7ee7525 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 00:42:49 +0500 Subject: [PATCH 047/133] Removed WSL Support --- settings.sh.save | 18 ------------------ settings.sh.save.1 | 18 ------------------ 2 files changed, 36 deletions(-) delete mode 100644 settings.sh.save delete mode 100644 settings.sh.save.1 diff --git a/settings.sh.save b/settings.sh.save deleted file mode 100644 index 2fdea16..0000000 --- a/settings.sh.save +++ /dev/null @@ -1,18 +0,0 @@ - - - - - -curl 'https://www.bankofmaldives.com.mv/internetbanking/api/user/setting' \ - -H 'authority: www.bankofmaldives.com.mv' \ - -H 'pragma: no-cache' \ - -H 'cache-control: no-cache' \ - -H 'accept: application/json, text/plain, */*' \ - -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36' \ - -H 'sec-fetch-site: same-origin' \ - -H 'sec-fetch-mode: cors' \ - -H 'sec-fetch-dest: empty' \ - -H 'referer: https://www.bankofmaldives.com.mv/internetbanking/services/applications/additional-account' \ - -H 'accept-language: en-US,en;q=0.9' \ - -H 'cookie: _ga=GA1.3.124704262.1610983104; __cfduid=db7fb4eee4148a228ab982945635908491617794172; _gid=GA1.3.416113663.1619468410; BNES_samesite=nUGtaZObWv78dkAR0E4QMJlriZV44DGffLR9DBncVIKf3l3C+4iEOoHsfmm92Y7D4MFzG9FnjLM=; BLAZEID=eyJpdiI6IjZyOEZNRVwvSXZDaVFQaGt2NmJsWnZRPT0iLCJ2YWx1ZSI6InFBSUh4THhsUnB4NDA1dFRRUm1maFpcL0I4OENYUHpzZzR4Y2d6aHhET2U5RUhoa1VwSnhvNmtRdldIdStQTnVlIiwibWFjIjoiNzA3ODU3MDFlMDJiZTg0ZTJjNzQ5ZmUzZTllZWVlYjcxY2NhNzNlNDVjNzkzOGYxNzY4ZmY0MzhjMjI5OTg3NCJ9; BNES_BLAZEID=ckZKCwsxF2HgzM+GkPbdL77qHQ9gXXuAFlz3kuDzFWiIZ1BYn0rJMz1x1meRxt4Zwf/VjgBL1WCDrFjXg1ekJU5fuTfJoeMsu1ftKoGxHjPpfTFnqgcyi/41Qw/dflmKUABUwWGV5JdjanoeULegT5JnxF7BCTeBfqCBTiWV6Fi9gBj7H1gF/6kwl3jlm3Om8dv9zfURCwsm8KcchfURtCYA1Wt9rb3y+kO/s/bPmle5cwLP4QaxWq0IwCZ6uFT4osXacvXMI4JYeSF1RR26DW4dp2rNBPzEdXT+Zt099vBCaqboH4mHvJi37iVdzcVkdKaZF2chSsiqozk2oo//TgyoqNFrU9I7aefy4ZwBOwLycH02cHqvCGcf7NOfTGsSgLMIFi7/JVU=' \ - --compressed diff --git a/settings.sh.save.1 b/settings.sh.save.1 deleted file mode 100644 index 2fdea16..0000000 --- a/settings.sh.save.1 +++ /dev/null @@ -1,18 +0,0 @@ - - - - - -curl 'https://www.bankofmaldives.com.mv/internetbanking/api/user/setting' \ - -H 'authority: www.bankofmaldives.com.mv' \ - -H 'pragma: no-cache' \ - -H 'cache-control: no-cache' \ - -H 'accept: application/json, text/plain, */*' \ - -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36' \ - -H 'sec-fetch-site: same-origin' \ - -H 'sec-fetch-mode: cors' \ - -H 'sec-fetch-dest: empty' \ - -H 'referer: https://www.bankofmaldives.com.mv/internetbanking/services/applications/additional-account' \ - -H 'accept-language: en-US,en;q=0.9' \ - -H 'cookie: _ga=GA1.3.124704262.1610983104; __cfduid=db7fb4eee4148a228ab982945635908491617794172; _gid=GA1.3.416113663.1619468410; BNES_samesite=nUGtaZObWv78dkAR0E4QMJlriZV44DGffLR9DBncVIKf3l3C+4iEOoHsfmm92Y7D4MFzG9FnjLM=; BLAZEID=eyJpdiI6IjZyOEZNRVwvSXZDaVFQaGt2NmJsWnZRPT0iLCJ2YWx1ZSI6InFBSUh4THhsUnB4NDA1dFRRUm1maFpcL0I4OENYUHpzZzR4Y2d6aHhET2U5RUhoa1VwSnhvNmtRdldIdStQTnVlIiwibWFjIjoiNzA3ODU3MDFlMDJiZTg0ZTJjNzQ5ZmUzZTllZWVlYjcxY2NhNzNlNDVjNzkzOGYxNzY4ZmY0MzhjMjI5OTg3NCJ9; BNES_BLAZEID=ckZKCwsxF2HgzM+GkPbdL77qHQ9gXXuAFlz3kuDzFWiIZ1BYn0rJMz1x1meRxt4Zwf/VjgBL1WCDrFjXg1ekJU5fuTfJoeMsu1ftKoGxHjPpfTFnqgcyi/41Qw/dflmKUABUwWGV5JdjanoeULegT5JnxF7BCTeBfqCBTiWV6Fi9gBj7H1gF/6kwl3jlm3Om8dv9zfURCwsm8KcchfURtCYA1Wt9rb3y+kO/s/bPmle5cwLP4QaxWq0IwCZ6uFT4osXacvXMI4JYeSF1RR26DW4dp2rNBPzEdXT+Zt099vBCaqboH4mHvJi37iVdzcVkdKaZF2chSsiqozk2oo//TgyoqNFrU9I7aefy4ZwBOwLycH02cHqvCGcf7NOfTGsSgLMIFi7/JVU=' \ - --compressed -- 2.47.2 From d3a0d0662580bf9bbb7cc054db2203c98ea6e7ed Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 14:59:19 +0500 Subject: [PATCH 048/133] Modular OS Detection --- bml.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/bml.sh b/bml.sh index 3a9ac77..73bb15e 100755 --- a/bml.sh +++ b/bml.sh @@ -23,16 +23,7 @@ lightgreen=`tput setaf 10` yellow=`tput setaf 11` reset=`tput sgr0` - -OS=$(uname -r | grep -oE microsoft) -if [ "$OS" = "microsoft" ] -then - echo "${red}WSL Not Supported!${reset}" - exit -else - : -fi - - +#run osdetect.sh, throw error into void if file not found +source osdetect.sh 2>/dev/null source readpass.sh -- 2.47.2 From 1bf47be2d75ece47eedb0b977172f4a0922239a8 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 15:08:22 +0500 Subject: [PATCH 049/133] Remove WSL and MacOS support --- osdetect.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 osdetect.sh diff --git a/osdetect.sh b/osdetect.sh new file mode 100644 index 0000000..26a29ee --- /dev/null +++ b/osdetect.sh @@ -0,0 +1,18 @@ +#!/bin/bash + + +if [ "uname -r | grep -oE microsoft" = "microsoft" ] + then + echo ${red}WSL Not Supported!${reset} + exit +elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] + then + echo ${red}MacOS Not Supported!${reset} + exit +else + : +fi + +source readpass.sh + + -- 2.47.2 From bebe36a4977d19e907e3a0489aee0320fa933162 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 15:17:09 +0500 Subject: [PATCH 050/133] Remove WSL and MacOS support --- README.md | 7 ++++--- osdetect.sh | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dc21e47..f167ecc 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,6 @@ BML CLI written in Bash. This project is currently under development and a lot o ### Termux `pkg install curl jq ncurses-utils` -## Bugs -- :) - ## Installation ``` git clone https://github.com/shihaamabr/bml-cli @@ -30,3 +27,7 @@ cd bml-cli chmod +x bml.sh ./bml.sh ``` + +## Bugs +- Throws error and exists on MacOS and WSL \ + Solution run: `rm osdetect.sh` diff --git a/osdetect.sh b/osdetect.sh index 26a29ee..de5f508 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -3,11 +3,11 @@ if [ "uname -r | grep -oE microsoft" = "microsoft" ] then - echo ${red}WSL Not Supported!${reset} + echo "${red}WSL Not Supported!${reset}" 1>&2 exit elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] then - echo ${red}MacOS Not Supported!${reset} + echo "${red}MacOS Not Supported!${reset}" 1>&2 exit else : -- 2.47.2 From 8c713c8dd3b1dce9d7c600da954a74b9b7b7cccd Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 15:20:46 +0500 Subject: [PATCH 051/133] Commit to make next commit comment epic --- README.md | 3 +-- bml.sh | 3 --- osdetect.sh | 18 ------------------ 3 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 osdetect.sh diff --git a/README.md b/README.md index f167ecc..51ef53b 100644 --- a/README.md +++ b/README.md @@ -29,5 +29,4 @@ chmod +x bml.sh ``` ## Bugs -- Throws error and exists on MacOS and WSL \ - Solution run: `rm osdetect.sh` +- :) diff --git a/bml.sh b/bml.sh index 73bb15e..8db0eb5 100755 --- a/bml.sh +++ b/bml.sh @@ -23,7 +23,4 @@ lightgreen=`tput setaf 10` yellow=`tput setaf 11` reset=`tput sgr0` -#run osdetect.sh, throw error into void if file not found -source osdetect.sh 2>/dev/null - source readpass.sh diff --git a/osdetect.sh b/osdetect.sh deleted file mode 100644 index de5f508..0000000 --- a/osdetect.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - - -if [ "uname -r | grep -oE microsoft" = "microsoft" ] - then - echo "${red}WSL Not Supported!${reset}" 1>&2 - exit -elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] - then - echo "${red}MacOS Not Supported!${reset}" 1>&2 - exit -else - : -fi - -source readpass.sh - - -- 2.47.2 From de015ea0422dc75e30b99a95e787bd57fbf49be6 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 15:23:59 +0500 Subject: [PATCH 052/133] Remove WSL and MacOS support --- README.md | 3 ++- bml.sh | 1 + osdetect.sh | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 osdetect.sh diff --git a/README.md b/README.md index 51ef53b..f167ecc 100644 --- a/README.md +++ b/README.md @@ -29,4 +29,5 @@ chmod +x bml.sh ``` ## Bugs -- :) +- Throws error and exists on MacOS and WSL \ + Solution run: `rm osdetect.sh` diff --git a/bml.sh b/bml.sh index 8db0eb5..2ed02ee 100755 --- a/bml.sh +++ b/bml.sh @@ -23,4 +23,5 @@ lightgreen=`tput setaf 10` yellow=`tput setaf 11` reset=`tput sgr0` +source osdetect.sh 2>/dev/null source readpass.sh diff --git a/osdetect.sh b/osdetect.sh new file mode 100644 index 0000000..9a31097 --- /dev/null +++ b/osdetect.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ "uname -r | grep -oE microsoft" = "microsoft" ] + then + echo "${red}WSL Not Supported!${reset}" 1>&2 + exit +elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] + then + echo "${red}MacOS Not Supported!${reset}" 1>&2 + exit +else + : +fi + +source readpass.sh -- 2.47.2 From 6fd8397eb7df261ecfc69c9ddd25cc2f78ed3825 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 29 Apr 2021 16:35:44 +0500 Subject: [PATCH 053/133] somehow it broke login --- bml.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bml.sh b/bml.sh index 2ed02ee..018da90 100755 --- a/bml.sh +++ b/bml.sh @@ -23,5 +23,6 @@ lightgreen=`tput setaf 10` yellow=`tput setaf 11` reset=`tput sgr0` -source osdetect.sh 2>/dev/null +#source osdetect.sh 2>/dev/null + source readpass.sh -- 2.47.2 From 1ca0f2abd62e5febbfe4f09d7b1b59f05232307b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 30 Apr 2021 02:26:48 +0500 Subject: [PATCH 054/133] experimental logo --- bml-logo.txt | 24 ++++++++++++++++++++++++ welcome.sh | 17 +++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 bml-logo.txt diff --git a/bml-logo.txt b/bml-logo.txt new file mode 100644 index 0000000..3829f89 --- /dev/null +++ b/bml-logo.txt @@ -0,0 +1,24 @@ +  + S8 S X S S X S S X S S X S S X S S X ;  + 8 ::;:;:::;:;:::;:;:::;:;:::;:;:::;:  + 8%888@8@8888@88888@8888@8@8888@88888X  + 8X@8@8888@888@8@888@8888%88@888@8@88.  + 8S888@8@888@88@88@8888:8t@88@888@88%   + 8X8@88888@88888@8888% ..8@88@8@88@88  + 8S888@8@88@88@888@88 8;88@88@88@8@8  + 8X@88@88@888@888@88t:t:8t@88@888888@S  + 8X8@888@88@8@8@@8@t  ;8;8@88@8@8@8@8  + 8S88@8@88@888@888@.8 8@8:@8888@88@8S:  + 8X@888888@88@888@ t t t8:8@88@88@8888  + 8X8@8@8@88@8888% X @S ;8:@8@88@888@@X  + 8S888@888@8@@8 .S.8@S8X8:@88@88@8@888  + 8X@8@88@88888%.@ @8@X ;  @8@88@8888%:  + 8X8@88@88@88 : 8S@88S8%8 @88@888@8@88  + 8S888888@88X%88;@88@XX88;8888@888@8S:  + 8X@88@@8888.88@;. ..;88Xt:  %88@888@@  + 8X8@8888@S;S8 8 8 88 8 8 8t@88@8888  + 8S88@8@88@X:@88X8SSS888888 8;8@88@8@X  + 8X@888@8888@ 8 S88@888888@S888@8@88  + 8X8@8@888@S. :X88@8888S:  + 8S888888@88@XSSttSXX@@@@@@88@88@8@888  + :; . .. ..:;;;;;t;;;::. : .  diff --git a/welcome.sh b/welcome.sh index db3b56d..ba5328b 100644 --- a/welcome.sh +++ b/welcome.sh @@ -14,14 +14,15 @@ IDCARD=$(curl -s -b $COOKIE $BML_URL/userinfo \ | jq -r '.["payload"] | .["user"] | .idcard') #display a Welcome message with fullname -echo "${red}" -echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" -echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" -echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" -echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" -echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" -echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" -echo "${reset}" +cat bml-logo.txt +#echo "${red}" +#echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" +#echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" +#echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" +#echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" +#echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" +#echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" +#echo "${reset}" echo ${green}Welcome ${reset}$NAME echo "" echo ${cyan}Phone${reset}: $PHONE -- 2.47.2 From d13c7dd70c021fe8d693a82132d75bacde850770 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 30 Apr 2021 12:25:55 +0500 Subject: [PATCH 055/133] remvoed experimental logo --- welcome.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/welcome.sh b/welcome.sh index ba5328b..db3b56d 100644 --- a/welcome.sh +++ b/welcome.sh @@ -14,15 +14,14 @@ IDCARD=$(curl -s -b $COOKIE $BML_URL/userinfo \ | jq -r '.["payload"] | .["user"] | .idcard') #display a Welcome message with fullname -cat bml-logo.txt -#echo "${red}" -#echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" -#echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" -#echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" -#echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" -#echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" -#echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" -#echo "${reset}" +echo "${red}" +echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" +echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" +echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" +echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" +echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" +echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" +echo "${reset}" echo ${green}Welcome ${reset}$NAME echo "" echo ${cyan}Phone${reset}: $PHONE -- 2.47.2 From 13b8f73dd0758faa27de8f5ccc94478bf9c251f3 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 30 Apr 2021 12:55:36 +0500 Subject: [PATCH 056/133] Notify when loggin in with saved pass --- readpass.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/readpass.sh b/readpass.sh index 4166da6..3a520e0 100644 --- a/readpass.sh +++ b/readpass.sh @@ -1,6 +1,7 @@ if [ -f $CREDENTIALS ] then source $CREDENTIALS + echo "Attempting to login with saved credentials" if [ "$LOGIN" = "2" ] then echo "${red}Login Required${reset}" -- 2.47.2 From 91a0d809e6cf4eebab4229e0e5fc6b49ff204117 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 30 Apr 2021 16:10:09 +0500 Subject: [PATCH 057/133] PASSWORD ENCRYPTION YOOOO --- README.md | 10 +++++----- readpass.sh | 8 +++++++- savepass.sh | 43 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index f167ecc..0ae4390 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,21 @@ BML CLI written in Bash. This project is currently under development and a lot o ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) ## Requirements -`curl` `jq` +`curl` `jq` `openssl` - Make sure all requirements are met before running script. - Termux users will need `ncurses-utils` additionally for terminal colors #### Arch Linux -`sudo pacman -S curl jq` +`sudo pacman -S curl jq openssl` #### Ubuntu -`sudo apt install curl jq` +`sudo apt install curl jq openssl` #### Fedora -`sudo dnf install curl jq` +`sudo dnf install curl jq openssl` ### Termux -`pkg install curl jq ncurses-utils` +`pkg install curl jq openssl ncurses-utils` ## Installation ``` diff --git a/readpass.sh b/readpass.sh index 3a520e0..b5eb7ac 100644 --- a/readpass.sh +++ b/readpass.sh @@ -1,7 +1,10 @@ if [ -f $CREDENTIALS ] then source $CREDENTIALS - echo "Attempting to login with saved credentials" +# echo "Attempting to login with saved credentials" + read -s -p 'Enter Pin: ' PIN + 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}" @@ -12,6 +15,9 @@ then else : fi + + + elif [ ! -f $CREDENTIALS ] then echo "${red}Login Required${reset}" diff --git a/savepass.sh b/savepass.sh index b5bfbfc..5fb60e9 100644 --- a/savepass.sh +++ b/savepass.sh @@ -1,5 +1,3 @@ -#echo "Do ${red}NOT${reset} save password if password contain '|' '^' '$' '&' ';' ':' '(' ')' " - if [ ! -f $CREDENTIALS ] then if [ "$LOGIN" = "0" ] @@ -7,15 +5,42 @@ then read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN if [ "$SAVE_LOGIN" = "Y" ] then - echo "Username and Password is saved in ${lightred}PAIN TEXT${reset} in $CREDENTIALS" - echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS - echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS + 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 elif [ "$SAVE_LOGIN" = "y" ] - then - echo "Username and Password is saved in ${lightred}PAIN TEXT${reset} in $CREDENTIALS" - echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS - echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS + 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 -- 2.47.2 From cfb9b9f3b9f33ace7e661d154bac34ec1e114bbe Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 30 Apr 2021 16:23:31 +0500 Subject: [PATCH 058/133] termux have a different package name for openssl smh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ae4390..a1bfa99 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ BML CLI written in Bash. This project is currently under development and a lot o `sudo dnf install curl jq openssl` ### Termux -`pkg install curl jq openssl ncurses-utils` +`pkg install curl jq openssl-tools ncurses-utils` ## Installation ``` -- 2.47.2 From 8d0b2bfe66001725caaadf746489a489f8964392 Mon Sep 17 00:00:00 2001 From: Inn Date: Fri, 30 Apr 2021 22:11:56 +0500 Subject: [PATCH 059/133] Updated a colors added a bit of spice --- bml.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bml.sh b/bml.sh index 018da90..2250f4e 100755 --- a/bml.sh +++ b/bml.sh @@ -10,12 +10,14 @@ COOKIE=~/.cache/bml-cli/cookie CREDENTIALS=~/.config/bml-cli/.env #Setting terminal output colors -red=`tput setaf 1` -green=`tput setaf 2` +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 6` +cyan=`tput setaf 39` gray=`tput setaf 7` darkgray=`tput setaf 8` lightred=`tput setaf 9` -- 2.47.2 From 1257f37b55dc74ab5b3a9457b3c8a4f4fc22ee62 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 30 Apr 2021 22:33:07 +0500 Subject: [PATCH 060/133] added clear and exit as valid input --- contactsmenu.sh | 40 ++++++++++++++++++++++++---------------- mainmenu.sh | 15 ++++++++++----- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/contactsmenu.sh b/contactsmenu.sh index 3cfbf63..21794e0 100644 --- a/contactsmenu.sh +++ b/contactsmenu.sh @@ -3,32 +3,40 @@ echo "Contacts" echo "" echo "1 - List Contacts" echo "2 - Add Contact" -echo "3 - Delete Conact" +echo "3 - Delete Contact" echo "4 - Go back" -echo "5 - Exit" echo "" printf 'Please Input: ' -read -r CONTATCS +read -r CONTACTS -if [ "$CONTATCS" = "1" ] - then +if [ "$CONTACTS" = "1" ] +then source listcontacts.sh -elif [ "$CONTATCS" = "2" ] - then +elif [ "$CONTACTS" = "2" ] +then source addcontact-menu.sh -elif [ "$CONTATCS" = "3" ] - then +elif [ "$CONTACTS" = "3" ] +then source deletecontact.sh -elif [ "$CONTATCS" = "4" ] - then +elif [ "$CONTACTS" = "4" ] +then source mainmenu.sh -elif [ "$CONTATCS" = "5" ] - then - rm $COOKIE +elif [ "$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}There was an error${reset}" 1>&2 + echo ${red}Invalid input:${yellow} $CONTACTS ${reset} 1>&2 source contactsmenu.sh fi diff --git a/mainmenu.sh b/mainmenu.sh index 8e19b9e..ec3f533 100644 --- a/mainmenu.sh +++ b/mainmenu.sh @@ -6,7 +6,6 @@ echo "3 - Contacts" echo "4 - Activities" echo "5 - Services" echo "6 - Settings" -echo "7 - Exit" echo "" printf 'Please Input: ' read -r MENU @@ -44,12 +43,18 @@ elif [ "$MENU" = "6" ] sleep 2 source mainmenu.sh source settingsmenu.sh -elif [ "$MENU" = "7" ] +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}There was an error${reset}" 1>&2 - - source mainmenu.sh + echo ${red}Invalid input:${yellow} $MENU ${reset} 1>&2 + source mainmenu.sh fi -- 2.47.2 From cf1f30e3460bbcd9914ad80686bd5c624a3cf9af Mon Sep 17 00:00:00 2001 From: Inn Date: Fri, 30 Apr 2021 22:36:48 +0500 Subject: [PATCH 061/133] Update bml.sh added a ` --- bml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bml.sh b/bml.sh index 2250f4e..9e5160c 100755 --- a/bml.sh +++ b/bml.sh @@ -10,7 +10,7 @@ COOKIE=~/.cache/bml-cli/cookie CREDENTIALS=~/.config/bml-cli/.env #Setting terminal output colors -red=`tput setaf 1 +red=`tput setaf 1` #errorred=`tput setaf 196` #validgreen=`tput setaf 82` green=`tput setaf 46` -- 2.47.2 From f7c2341e1c1d4c285c3e611af07f07fbd5575185 Mon Sep 17 00:00:00 2001 From: itay alush <66872595+itayalush1@users.noreply.github.com> Date: Fri, 30 Apr 2021 22:05:51 +0300 Subject: [PATCH 062/133] Added OpenSUSE instructions --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a1bfa99..15f34e3 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ BML CLI written in Bash. This project is currently under development and a lot o ### Termux `pkg install curl jq openssl-tools ncurses-utils` +### OpenSUSE +`sudo zypper install curl jq openssl` + ## Installation ``` git clone https://github.com/shihaamabr/bml-cli -- 2.47.2 From 3960dab9dddd4afcabf509c6d6215b3ae0a6802b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 01:20:37 +0500 Subject: [PATCH 063/133] added password reset when account locked --- bml.sh | 2 +- login.sh | 10 +++++++++- osdetect.sh | 10 ++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bml.sh b/bml.sh index 9e5160c..1a7d2a6 100755 --- a/bml.sh +++ b/bml.sh @@ -25,6 +25,6 @@ lightgreen=`tput setaf 10` yellow=`tput setaf 11` reset=`tput sgr0` -#source osdetect.sh 2>/dev/null +source osdetect.sh source readpass.sh diff --git a/login.sh b/login.sh index 8d8a54d..a47c104 100644 --- a/login.sh +++ b/login.sh @@ -13,7 +13,15 @@ if [ "$LOGIN" = "0" ] elif [ "$LOGIN" = "20" ] then echo "${red}Account Locked!${reset}" - exit + echo "${lightred}Please reset password and login again.${reset}" + echo "" + if [ "$MAC" = "true" ] + then + open https://www.bankofmaldives.com.mv/internetbanking/forgot_password + else + xdg-open https://www.bankofmaldives.com.mv/internetbanking/forgot_password + fi + source readpass.sh elif [ "$LOGIN" = "2" ] then source readpass.sh diff --git a/osdetect.sh b/osdetect.sh index 9a31097..fac30b9 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -2,12 +2,14 @@ if [ "uname -r | grep -oE microsoft" = "microsoft" ] then - echo "${red}WSL Not Supported!${reset}" 1>&2 - exit + WSL=true + #echo "${red}WSL Not Supported!${reset}" 1>&2 + #exit elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] then - echo "${red}MacOS Not Supported!${reset}" 1>&2 - exit + #echo "${red}MacOS Not Supported!${reset}" 1>&2 + #exit + MAC=true else : fi -- 2.47.2 From c4f3d63927949f80d92562910eb1f105f3d953ad Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 01:28:51 +0500 Subject: [PATCH 064/133] added password reset for WSL --- login.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/login.sh b/login.sh index a47c104..2f46131 100644 --- a/login.sh +++ b/login.sh @@ -17,9 +17,12 @@ elif [ "$LOGIN" = "20" ] echo "" if [ "$MAC" = "true" ] then - open https://www.bankofmaldives.com.mv/internetbanking/forgot_password + open https://www.bankofmaldives.com.mv/internetbanking/forgot_password + elif [ "$WSL" = "true" ] + then + cmd.exe /C START https://www.bankofmaldives.com.mv/internetbanking/forgot_password else - xdg-open https://www.bankofmaldives.com.mv/internetbanking/forgot_password + xdg-open https://www.bankofmaldives.com.mv/internetbanking/forgot_password fi source readpass.sh elif [ "$LOGIN" = "2" ] -- 2.47.2 From acaeb063699dc152bdafbdbf08652e1419fb14e4 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 01:33:21 +0500 Subject: [PATCH 065/133] added password reset for WSL --- osdetect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osdetect.sh b/osdetect.sh index fac30b9..c4f95cc 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -7,9 +7,9 @@ if [ "uname -r | grep -oE microsoft" = "microsoft" ] #exit elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] then + MAC=true #echo "${red}MacOS Not Supported!${reset}" 1>&2 #exit - MAC=true else : fi -- 2.47.2 From edb2c6248797fb55f4928e157aa8a07430aeb4d6 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 04:36:27 +0500 Subject: [PATCH 066/133] password reset link vairable --- bml.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bml.sh b/bml.sh index 1a7d2a6..11da79a 100755 --- a/bml.sh +++ b/bml.sh @@ -6,6 +6,7 @@ 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 -- 2.47.2 From f6ff6cab57e2272ba87906e4b69b5b427035e4d9 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 04:38:03 +0500 Subject: [PATCH 067/133] Added android detection --- osdetect.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osdetect.sh b/osdetect.sh index c4f95cc..033f8f2 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -10,6 +10,9 @@ elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] MAC=true #echo "${red}MacOS Not Supported!${reset}" 1>&2 #exit +elif [ "uname -a | grep -oE Android" = "Android" ] + then + ANDROID=true else : fi -- 2.47.2 From 88acfe3f9b555338ea68f98b4e4720ffd6eaa1fd Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 04:43:21 +0500 Subject: [PATCH 068/133] Added pass reset on android --- login.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/login.sh b/login.sh index 2f46131..2e6154a 100644 --- a/login.sh +++ b/login.sh @@ -17,12 +17,15 @@ elif [ "$LOGIN" = "20" ] echo "" if [ "$MAC" = "true" ] then - open https://www.bankofmaldives.com.mv/internetbanking/forgot_password + open $BML_RESETPASS elif [ "$WSL" = "true" ] then - cmd.exe /C START https://www.bankofmaldives.com.mv/internetbanking/forgot_password + cmd.exe /C START $BML_RESETPASS + elif [ "$ANDROID" = "true" ] + then + am start -a android.intent.action.VIEW -d $BML_RESETPASS else - xdg-open https://www.bankofmaldives.com.mv/internetbanking/forgot_password + xdg-open $BML_RESETPASS fi source readpass.sh elif [ "$LOGIN" = "2" ] @@ -33,4 +36,3 @@ else exit fi - -- 2.47.2 From f918452f145e478c310c3e32033931fd67a39dc5 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 04:43:51 +0500 Subject: [PATCH 069/133] removed logo --- bml-logo.txt | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 bml-logo.txt diff --git a/bml-logo.txt b/bml-logo.txt deleted file mode 100644 index 3829f89..0000000 --- a/bml-logo.txt +++ /dev/null @@ -1,24 +0,0 @@ -  - S8 S X S S X S S X S S X S S X S S X ;  - 8 ::;:;:::;:;:::;:;:::;:;:::;:;:::;:  - 8%888@8@8888@88888@8888@8@8888@88888X  - 8X@8@8888@888@8@888@8888%88@888@8@88.  - 8S888@8@888@88@88@8888:8t@88@888@88%   - 8X8@88888@88888@8888% ..8@88@8@88@88  - 8S888@8@88@88@888@88 8;88@88@88@8@8  - 8X@88@88@888@888@88t:t:8t@88@888888@S  - 8X8@888@88@8@8@@8@t  ;8;8@88@8@8@8@8  - 8S88@8@88@888@888@.8 8@8:@8888@88@8S:  - 8X@888888@88@888@ t t t8:8@88@88@8888  - 8X8@8@8@88@8888% X @S ;8:@8@88@888@@X  - 8S888@888@8@@8 .S.8@S8X8:@88@88@8@888  - 8X@8@88@88888%.@ @8@X ;  @8@88@8888%:  - 8X8@88@88@88 : 8S@88S8%8 @88@888@8@88  - 8S888888@88X%88;@88@XX88;8888@888@8S:  - 8X@88@@8888.88@;. ..;88Xt:  %88@888@@  - 8X8@8888@S;S8 8 8 88 8 8 8t@88@8888  - 8S88@8@88@X:@88X8SSS888888 8;8@88@8@X  - 8X@888@8888@ 8 S88@888888@S888@8@88  - 8X8@8@888@S. :X88@8888S:  - 8S888888@88@XSSttSXX@@@@@@88@88@8@888  - :; . .. ..:;;;;;t;;;::. : .  -- 2.47.2 From 7e2193c1309bd939e641dbe1d99fbd1779d0e474 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 14:07:30 +0500 Subject: [PATCH 070/133] added logout --- logout.sh | 6 +++++- mainmenu.sh | 6 +++--- settings-menu.sh | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 settings-menu.sh diff --git a/logout.sh b/logout.sh index 8b13789..f35bba6 100644 --- a/logout.sh +++ b/logout.sh @@ -1 +1,5 @@ - +rm $CREDENTIALS +rm $COOKIE +echo "Cleaning up.." +sleep 0.4 +exit diff --git a/mainmenu.sh b/mainmenu.sh index ec3f533..e3077f4 100644 --- a/mainmenu.sh +++ b/mainmenu.sh @@ -40,9 +40,9 @@ elif [ "$MENU" = "5" ] elif [ "$MENU" = "6" ] then echo "WIP" - sleep 2 - source mainmenu.sh - source settingsmenu.sh +# sleep 2 +# source mainmenu.sh + source settings-menu.sh elif [ "$MENU" = "clear" ] then clear diff --git a/settings-menu.sh b/settings-menu.sh new file mode 100644 index 0000000..d549f4f --- /dev/null +++ b/settings-menu.sh @@ -0,0 +1,34 @@ +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" = "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 SETTINGSmenu.sh +fi -- 2.47.2 From 5f757b26c63706f7f96511d38e5d0edefa01d9bc Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 1 May 2021 14:54:30 +0500 Subject: [PATCH 071/133] getting ready for adding password change --- changepassword.sh | 40 ++++++++++++++++++++++++++++++++++++++++ readpass.sh | 1 + savepass.sh | 2 ++ 3 files changed, 43 insertions(+) create mode 100644 changepassword.sh diff --git a/changepassword.sh b/changepassword.sh new file mode 100644 index 0000000..58cfdd9 --- /dev/null +++ b/changepassword.sh @@ -0,0 +1,40 @@ + + + read -s -p 'Enter Current Password: ' OLD_PASSWORD + echo "" + read -s -p 'Enter New Password: ' NEW_PASSWORD + echo "" + read -s -p 'Repeat New Password: ' REPEAT_NEWPASSWORD + if [ "$NEW_PASSWORD" = "$REPEAT_NEWPASSWORD" ] + then + echo "Select OTP Method:" + echo "1 - Mobile" + echo "2 - Email" + echo "" + echo "Please input: " + read -r OTPCHANNEL + if [ "$OTPCHANNEL" = "1" ] + then + OTPCHANNEL=mobile + elif [ "$OTPCHANNEL" = "2" ] + then + OTPCHANNEL=email + else + echo "${red}Invalid Input${reset}" + fi + + + 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 + + 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 diff --git a/readpass.sh b/readpass.sh index b5eb7ac..dbe0e49 100644 --- a/readpass.sh +++ b/readpass.sh @@ -3,6 +3,7 @@ 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" ] diff --git a/savepass.sh b/savepass.sh index 5fb60e9..22cbbe8 100644 --- a/savepass.sh +++ b/savepass.sh @@ -51,4 +51,6 @@ 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 -- 2.47.2 From 2387c561e72fec591eb018ba064079c6cfe11687 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 2 May 2021 00:36:26 +0500 Subject: [PATCH 072/133] attempt to reduce lines by using OR instead of elif --- addcontact-menu.sh | 5 +---- contactsmenu.sh | 5 +---- osdetect.sh | 2 +- savepass.sh | 21 +-------------------- settings-menu.sh | 2 +- 5 files changed, 5 insertions(+), 30 deletions(-) diff --git a/addcontact-menu.sh b/addcontact-menu.sh index 55753b1..03540d4 100644 --- a/addcontact-menu.sh +++ b/addcontact-menu.sh @@ -11,12 +11,9 @@ echo "" printf 'Select contact type[1]: ' read -r CONTACT_TYPE -if [ "$CONTACT_TYPE" = "1" ] +if [ "$CONTACT_TYPE" = "1" ] || [ "$CONTACT_TYPE" = "" ] then source addcontact-bml.sh -elif [ "$CONTACT_TYPE" = "" ] - then - source addcontact-bml.sh elif [ "$CONTATC_TYPE" = "2" ] then echo "${red}WORK IN PROGRESS${reset}" diff --git a/contactsmenu.sh b/contactsmenu.sh index 21794e0..ed81d5d 100644 --- a/contactsmenu.sh +++ b/contactsmenu.sh @@ -18,10 +18,7 @@ then elif [ "$CONTACTS" = "3" ] then source deletecontact.sh -elif [ "$CONTACTS" = "4" ] -then - source mainmenu.sh -elif [ "$CONTACTS" = "back" ] +elif [ "$CONTACTS" = "4" ] || [ "$CONTACTS" = "back" ] then sleep 0.2 source mainmenu.sh diff --git a/osdetect.sh b/osdetect.sh index 033f8f2..603362e 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "uname -r | grep -oE microsoft" = "microsoft" ] +if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ "uname -r | grep -oE Microsoft" = "Microsoft" ] then WSL=true #echo "${red}WSL Not Supported!${reset}" 1>&2 diff --git a/savepass.sh b/savepass.sh index 22cbbe8..5eb6d49 100644 --- a/savepass.sh +++ b/savepass.sh @@ -3,7 +3,7 @@ then if [ "$LOGIN" = "0" ] then read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN - if [ "$SAVE_LOGIN" = "Y" ] + if [ "$SAVE_LOGIN" = "Y" ] || [ "$SAVE_LOGIN" = "y" ] then read -s -p 'Enter Pin: ' PIN echo "" @@ -22,25 +22,6 @@ then echo "${red}Pin do not match${reset}" source savepass.sh fi - elif [ "$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 diff --git a/settings-menu.sh b/settings-menu.sh index d549f4f..5d060d3 100644 --- a/settings-menu.sh +++ b/settings-menu.sh @@ -14,7 +14,7 @@ then elif [ "$SETTINGS" = "2" ] then source changepassword.sh -elif [ "$SETTINGS" = "back" ] +elif [ "$SETTINGS" = "2" ] || [ "$SETTINGS" = "back" ] then source mainmenu.sh elif [ "$SETTINGS" = "clear" ] -- 2.47.2 From 83f2236eed03c2403a1a0af0751dc574f53fc9c8 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 3 May 2021 22:19:12 +0500 Subject: [PATCH 073/133] installer - beta --- bml.sh | 3 +++ installer.sh | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 installer.sh diff --git a/bml.sh b/bml.sh index 11da79a..d252291 100755 --- a/bml.sh +++ b/bml.sh @@ -10,6 +10,9 @@ BML_RESETPASS='https://www.bankofmaldives.com.mv/internetbanking/forgot_password COOKIE=~/.cache/bml-cli/cookie CREDENTIALS=~/.config/bml-cli/.env +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd $DIR + #Setting terminal output colors red=`tput setaf 1` #errorred=`tput setaf 196` diff --git a/installer.sh b/installer.sh new file mode 100644 index 0000000..74fa177 --- /dev/null +++ b/installer.sh @@ -0,0 +1,10 @@ +#!/bin/bash +cd /tmp/ +git clone https://github.com/shihaamabr/bml-cli.git 1> /dev/null +mkdir -p /opt/sar/bml-cli/ +mv bml-cli/* /opt/sar/bml-cli/ +touch /usr/bin/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 +echo "Installation Complete" -- 2.47.2 From e284af1de6065977951b762cb9fdc6cb5330b954 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 3 May 2021 22:30:20 +0500 Subject: [PATCH 074/133] installer - beta2 --- installer.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 74fa177..f56c36f 100644 --- a/installer.sh +++ b/installer.sh @@ -1,10 +1,12 @@ #!/bin/bash cd /tmp/ -git clone https://github.com/shihaamabr/bml-cli.git 1> /dev/null +git clone https://github.com/shihaamabr/bml-cli.git mkdir -p /opt/sar/bml-cli/ +rm /opt/sar/bml-cli/* mv bml-cli/* /opt/sar/bml-cli/ touch /usr/bin/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" -- 2.47.2 From 23ec0510ab2bb8be2eb03be578825af0eaef9b8f Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 3 May 2021 22:34:42 +0500 Subject: [PATCH 075/133] installer - beta3 --- installer.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/installer.sh b/installer.sh index f56c36f..998e1ca 100644 --- a/installer.sh +++ b/installer.sh @@ -2,9 +2,7 @@ cd /tmp/ git clone https://github.com/shihaamabr/bml-cli.git mkdir -p /opt/sar/bml-cli/ -rm /opt/sar/bml-cli/* mv bml-cli/* /opt/sar/bml-cli/ -touch /usr/bin/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 -- 2.47.2 From 7f1d6590d0168d0c05f9df2a21bcfae167982e1d Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 3 May 2021 22:39:39 +0500 Subject: [PATCH 076/133] installer - readme update --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 15f34e3..5f46803 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,17 @@ BML CLI written in Bash. This project is currently under development and a lot o ### OpenSUSE `sudo zypper install curl jq openssl` -## Installation +## Installation - git ``` git clone https://github.com/shihaamabr/bml-cli cd bml-cli chmod +x bml.sh ./bml.sh ``` +## Installation systemwide - BETA +`curl -sSL https://install-bml-cli.shihaam.dev | bash` + + ## Bugs - Throws error and exists on MacOS and WSL \ -- 2.47.2 From 82164214afcd3bc5e51fe60ecaf9e66167124098 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 3 May 2021 22:44:59 +0500 Subject: [PATCH 077/133] installer - readme update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f46803..466030c 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ chmod +x bml.sh ./bml.sh ``` ## Installation systemwide - BETA -`curl -sSL https://install-bml-cli.shihaam.dev | bash` +`curl -sSL https://install.bml-cli.shihaam.dev | bash` -- 2.47.2 From 07c74d01fec14558dad6811a5bca234eda95e2d1 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 3 May 2021 23:06:43 +0500 Subject: [PATCH 078/133] installer - readme update forgot sudo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 466030c..36c5bf5 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ chmod +x bml.sh ./bml.sh ``` ## Installation systemwide - BETA -`curl -sSL https://install.bml-cli.shihaam.dev | bash` +`curl -sSL https://install.bml-cli.shihaam.dev | sudo bash` -- 2.47.2 From ea7dd90b88d417d065526472a858154da0f8f894 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 4 May 2021 00:35:44 +0500 Subject: [PATCH 079/133] fix settings menu --- settings-menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings-menu.sh b/settings-menu.sh index 5d060d3..0b7d995 100644 --- a/settings-menu.sh +++ b/settings-menu.sh @@ -14,7 +14,7 @@ then elif [ "$SETTINGS" = "2" ] then source changepassword.sh -elif [ "$SETTINGS" = "2" ] || [ "$SETTINGS" = "back" ] +elif [ "$SETTINGS" = "3" ] || [ "$SETTINGS" = "back" ] then source mainmenu.sh elif [ "$SETTINGS" = "clear" ] @@ -30,5 +30,5 @@ then exit else echo ${red}Invalid input:${yellow} $SETTINGS ${reset} 1>&2 - source SETTINGSmenu.sh + source settings-menu.sh fi -- 2.47.2 From 8b1538d9d1ac2a11ae6113e783aa7d883377b49b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 4 May 2021 00:43:09 +0500 Subject: [PATCH 080/133] fix birthday --- welcome.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/welcome.sh b/welcome.sh index db3b56d..5bb4044 100644 --- a/welcome.sh +++ b/welcome.sh @@ -8,8 +8,8 @@ PHONE=$(curl -s -b $COOKIE $BML_URL/userinfo \ EMAIL=$(curl -s -b $COOKIE $BML_URL/userinfo \ | jq -r '.["payload"] | .["user"] | .email') DOB=$(curl -s -b $COOKIE $BML_URL/userinfo \ - | jq -r '.["payload"] | .["user"] | .birthdate') -# | cut -f1 -d 'T' ) + | jq -r '.["payload"] | .["user"] | .birthdate' \ + | cut -d 'T' -f 1) IDCARD=$(curl -s -b $COOKIE $BML_URL/userinfo \ | jq -r '.["payload"] | .["user"] | .idcard') -- 2.47.2 From b6a6df2bf2d1d466ae4c0f392a23a88223e355d5 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 4 May 2021 19:17:54 +0500 Subject: [PATCH 081/133] reduced repeated network requests - thanks phoenixatom --- welcome.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/welcome.sh b/welcome.sh index 5bb4044..5acbcf8 100644 --- a/welcome.sh +++ b/welcome.sh @@ -1,17 +1,20 @@ #Requesting for User profile after login and regex to grap the Full name curl -s -b $COOKIE $BML_URL/profile > /dev/null -NAME=$(curl -s -b $COOKIE $BML_URL/userinfo \ - | jq -r '.["payload"] | .["user"] | .fullname') -PHONE=$(curl -s -b $COOKIE $BML_URL/userinfo \ - | jq -r '.["payload"] | .["user"] | .mobile_phone') -EMAIL=$(curl -s -b $COOKIE $BML_URL/userinfo \ - | jq -r '.["payload"] | .["user"] | .email') -DOB=$(curl -s -b $COOKIE $BML_URL/userinfo \ - | jq -r '.["payload"] | .["user"] | .birthdate' \ - | cut -d 'T' -f 1) -IDCARD=$(curl -s -b $COOKIE $BML_URL/userinfo \ - | jq -r '.["payload"] | .["user"] | .idcard') +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}" -- 2.47.2 From 89f8ed49c81508eef5e84be906d74cf084135117 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 4 May 2021 21:59:50 +0500 Subject: [PATCH 082/133] fix wsl detect --- osdetect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osdetect.sh b/osdetect.sh index 603362e..d98719d 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ "uname -r | grep -oE Microsoft" = "Microsoft" ] +if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ "uname -r | grep -oE Microsoft" = "Microsoft" ] || [ "uname -r | grep -oE icrosoft" = "icrosoft" ] then WSL=true #echo "${red}WSL Not Supported!${reset}" 1>&2 -- 2.47.2 From 08a71321b77de36912efb39bc679dbe35122f53f Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 7 May 2021 13:39:27 +0500 Subject: [PATCH 083/133] epic password change --- changepassword.sh | 110 ++++++++++++++++++++++++++++++++-------------- mainmenu.sh | 3 -- 2 files changed, 78 insertions(+), 35 deletions(-) diff --git a/changepassword.sh b/changepassword.sh index 58cfdd9..d429346 100644 --- a/changepassword.sh +++ b/changepassword.sh @@ -1,40 +1,86 @@ +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 - read -s -p 'Enter Current Password: ' OLD_PASSWORD - echo "" - read -s -p 'Enter New Password: ' NEW_PASSWORD - echo "" - read -s -p 'Repeat New Password: ' REPEAT_NEWPASSWORD - if [ "$NEW_PASSWORD" = "$REPEAT_NEWPASSWORD" ] - then - echo "Select OTP Method:" - echo "1 - Mobile" - echo "2 - Email" - echo "" - echo "Please input: " - read -r OTPCHANNEL - if [ "$OTPCHANNEL" = "1" ] - then - OTPCHANNEL=mobile - elif [ "$OTPCHANNEL" = "2" ] - then - OTPCHANNEL=email - else - echo "${red}Invalid Input${reset}" - fi +if [ "$OTPCHANNEL" = "mobile" ] + then + ECHOOTPCHANNEL=$PHONE +elif [ "$OTPCHANNEL" = "email" ] + then + ECHOOTPCHANNEL=$EMAIL +fi - - curl -s -b $COOKIE $BML_URL/user/changepassword' \ +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 \ - --compressed - - 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 + --compressed \ + | jq -r .success) + +if [ "$PASSCHANGED" != "true" ] + then + echo "${red}Failed to change password${reset}" +else + echo "${lightgreen}Password changed succesfully ${reset}" + source settings-menu.sh +fi diff --git a/mainmenu.sh b/mainmenu.sh index e3077f4..7dcaf5d 100644 --- a/mainmenu.sh +++ b/mainmenu.sh @@ -39,9 +39,6 @@ elif [ "$MENU" = "5" ] source services.sh elif [ "$MENU" = "6" ] then - echo "WIP" -# sleep 2 -# source mainmenu.sh source settings-menu.sh elif [ "$MENU" = "clear" ] then -- 2.47.2 From e8543d055c6bc5049387671ed738e080151764d9 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 7 May 2021 15:33:43 +0500 Subject: [PATCH 084/133] LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5a97aa0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Shiham Abdul Rahman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. -- 2.47.2 From 1b56985ae6bd135f4aa5055560c26a59a1410989 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 8 May 2021 13:33:29 +0500 Subject: [PATCH 085/133] testing accounts --- accounts.sh | 11 +++++++++++ mainmenu.sh | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 accounts.sh diff --git a/accounts.sh b/accounts.sh new file mode 100644 index 0000000..a924ca6 --- /dev/null +++ b/accounts.sh @@ -0,0 +1,11 @@ +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/mainmenu.sh b/mainmenu.sh index 7dcaf5d..fd630b4 100644 --- a/mainmenu.sh +++ b/mainmenu.sh @@ -14,8 +14,8 @@ if [ "$MENU" = "1" ] then echo "WIP" sleep 2 - source mainmenu.sh - #source accounts.sh + #source mainmenu.sh + source accounts.sh elif [ "$MENU" = "2" ] then echo "WIP" -- 2.47.2 From 9dfb397391d5294f972db833eead1d5b594c0b92 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 8 May 2021 15:13:29 +0500 Subject: [PATCH 086/133] reduce useless lines --- bml.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bml.sh b/bml.sh index d252291..94b77b4 100755 --- a/bml.sh +++ b/bml.sh @@ -10,8 +10,7 @@ BML_RESETPASS='https://www.bankofmaldives.com.mv/internetbanking/forgot_password COOKIE=~/.cache/bml-cli/cookie CREDENTIALS=~/.config/bml-cli/.env -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -cd $DIR +cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 #Setting terminal output colors red=`tput setaf 1` -- 2.47.2 From fad3a80d5b04a9616b29ca6bfb6c295b056a4477 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 8 May 2021 19:17:05 +0500 Subject: [PATCH 087/133] urandom --- changepassword.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changepassword.sh b/changepassword.sh index d429346..71958dc 100644 --- a/changepassword.sh +++ b/changepassword.sh @@ -82,5 +82,8 @@ if [ "$PASSCHANGED" != "true" ] echo "${red}Failed to change password${reset}" else echo "${lightgreen}Password changed succesfully ${reset}" + 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) source settings-menu.sh fi -- 2.47.2 From 7a08cec3364dbf766e09ffd452e6f4fddc20eac0 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 8 May 2021 19:29:58 +0500 Subject: [PATCH 088/133] logout after password change --- changepassword.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/changepassword.sh b/changepassword.sh index 71958dc..a1df7ee 100644 --- a/changepassword.sh +++ b/changepassword.sh @@ -55,7 +55,6 @@ else : fi - if [ "$OTPCHANNEL" = "mobile" ] then ECHOOTPCHANNEL=$PHONE @@ -77,13 +76,15 @@ PASSCHANGED=$(curl -s -b $COOKIE $BML_URL/user/changepassword \ --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}" - 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) - source settings-menu.sh + rm $CREDENTIALS + source readpass.sh fi -- 2.47.2 From 0b20e0d44797818b6513c88ea7c4708105309d6a Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 10 May 2021 20:00:04 +0500 Subject: [PATCH 089/133] Fixed issue with accounts with multiple profiles --- welcome.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/welcome.sh b/welcome.sh index 5acbcf8..71b84d8 100644 --- a/welcome.sh +++ b/welcome.sh @@ -1,5 +1,11 @@ #Requesting for User profile after login and regex to grap the Full name -curl -s -b $COOKIE $BML_URL/profile > /dev/null +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"]') -- 2.47.2 From 823ed51c5b52f72e6ef233491bf5a76c961f80e5 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 10 May 2021 20:49:18 +0500 Subject: [PATCH 090/133] readmeupdate macos bug --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 36c5bf5..baaa0b0 100644 --- a/README.md +++ b/README.md @@ -36,5 +36,4 @@ chmod +x bml.sh ## Bugs -- Throws error and exists on MacOS and WSL \ - Solution run: `rm osdetect.sh` +- Password save does not work on LibreSSL 2.8.3, Homebrew installs this version on MacOS -- 2.47.2 From 84637f4f32403e28cb461fc45e1baf7db7028a64 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 10 May 2021 22:14:08 +0500 Subject: [PATCH 091/133] attenmt to fix encryption on macos --- login.sh | 6 +++--- osdetect.sh | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/login.sh b/login.sh index 2e6154a..a2ac390 100644 --- a/login.sh +++ b/login.sh @@ -15,13 +15,13 @@ elif [ "$LOGIN" = "20" ] echo "${red}Account Locked!${reset}" echo "${lightred}Please reset password and login again.${reset}" echo "" - if [ "$MAC" = "true" ] + if [ "$OS" = "macos" ] then open $BML_RESETPASS - elif [ "$WSL" = "true" ] + elif [ "$OS" = "windows" ] then cmd.exe /C START $BML_RESETPASS - elif [ "$ANDROID" = "true" ] + elif [ "$OS" = "android" ] then am start -a android.intent.action.VIEW -d $BML_RESETPASS else diff --git a/osdetect.sh b/osdetect.sh index d98719d..122ae6a 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -1,18 +1,19 @@ #!/bin/bash -if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ "uname -r | grep -oE Microsoft" = "Microsoft" ] || [ "uname -r | grep -oE icrosoft" = "icrosoft" ] +if [ "uname -r | grep -oE microsoft" = "microsoft" ] then - WSL=true - #echo "${red}WSL Not Supported!${reset}" 1>&2 + OS=windows + #echo ${red}WSL Not Supported!${reset} 1>&2 #exit elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] then - MAC=true - #echo "${red}MacOS Not Supported!${reset}" 1>&2 + OS=macos + export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" + #echo ${red}MacOS Not Supported!${reset} 1>&2 #exit elif [ "uname -a | grep -oE Android" = "Android" ] then - ANDROID=true + OS=android else : fi -- 2.47.2 From 1b63f49985a04935566c62f94182d9e28e9e4bab Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 10 May 2021 22:34:46 +0500 Subject: [PATCH 092/133] improved macos detect --- osdetect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osdetect.sh b/osdetect.sh index 122ae6a..2125179 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -5,7 +5,7 @@ if [ "uname -r | grep -oE microsoft" = "microsoft" ] OS=windows #echo ${red}WSL Not Supported!${reset} 1>&2 #exit -elif [ "uname -a | grep -oE Darwin | tail -n1" = "Darwin" ] +elif [ $(uname -a | grep -oE Darwin | tail -n1) = "Darwin" ] then OS=macos export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" -- 2.47.2 From 443d189d7df221d55eaa171a502de0ced32ad192 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 10 May 2021 22:51:11 +0500 Subject: [PATCH 093/133] improved wsl1 detect --- osdetect.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osdetect.sh b/osdetect.sh index 2125179..3a493af 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -1,6 +1,5 @@ #!/bin/bash - -if [ "uname -r | grep -oE microsoft" = "microsoft" ] +if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ $(uname -r | grep -oE Microsoft) = "Microsoft" ] then OS=windows #echo ${red}WSL Not Supported!${reset} 1>&2 -- 2.47.2 From 285f63eaea55b3442223fbf077b7c4ac4cf3e696 Mon Sep 17 00:00:00 2001 From: Ibrahim Bassam Date: Wed, 12 May 2021 00:01:49 +0500 Subject: [PATCH 094/133] fixed WSL1 and WSL2 --- osdetect.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/osdetect.sh b/osdetect.sh index 3a493af..592ebb6 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -1,20 +1,26 @@ #!/bin/bash -if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ $(uname -r | grep -oE Microsoft) = "Microsoft" ] +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 + OS=windows #echo ${red}WSL Not Supported!${reset} 1>&2 #exit -elif [ $(uname -a | grep -oE Darwin | tail -n1) = "Darwin" ] +elif [ "$MAC" = "Darwin" ] then - OS=macos - export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" + OS=macos + export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" #echo ${red}MacOS Not Supported!${reset} 1>&2 #exit -elif [ "uname -a | grep -oE Android" = "Android" ] - then - OS=android +elif [ "$ANDROID" = "Android" ] + then + OS=android else : fi source readpass.sh + -- 2.47.2 From 4f423cf75f73e3a1ebf528ce4d5b71089d981ee0 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 14 May 2021 04:18:24 +0500 Subject: [PATCH 095/133] You tell me :) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index baaa0b0..904bf84 100644 --- a/README.md +++ b/README.md @@ -36,4 +36,4 @@ chmod +x bml.sh ## Bugs -- Password save does not work on LibreSSL 2.8.3, Homebrew installs this version on MacOS +- [You tell me :)](https://github.com/shihaamabr/bml-cli/issues/new) -- 2.47.2 From 1b7e9d67b1a679d4fa2254253ec2c593dfafe0f3 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 14 May 2021 04:27:13 +0500 Subject: [PATCH 096/133] Readme Clean up --- README.md | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 904bf84..3621606 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,26 @@ # Bank of Maldives CLI -BML CLI written in Bash. This project is currently under development and a lot of things are broken. - +## BML CLI written in Bash. +This project is currently under development and a lot of things are broken. ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) - -## Requirements + +## Getting Started +### Requirements `curl` `jq` `openssl` -- Make sure all requirements are met before running script. +- Install with whatever package manager you use. +- Make SURE all requirements are met before running script. - Termux users will need `ncurses-utils` additionally for terminal colors -#### Arch Linux -`sudo pacman -S curl jq openssl` - -#### Ubuntu -`sudo apt install curl jq openssl` - -#### Fedora -`sudo dnf install curl jq openssl` - -### Termux -`pkg install curl jq openssl-tools ncurses-utils` - -### OpenSUSE -`sudo zypper install curl jq openssl` - -## Installation - git +#### Installation - GIT (Recommended) ``` git clone https://github.com/shihaamabr/bml-cli cd bml-cli chmod +x bml.sh ./bml.sh ``` -## Installation systemwide - BETA -`curl -sSL https://install.bml-cli.shihaam.dev | sudo bash` - - +#### Installation - Systemwide (NOT Recommended, May not work) +``` +curl -sSL https://install.bml-cli.shihaam.dev | sudo bash +``` ## Bugs - [You tell me :)](https://github.com/shihaamabr/bml-cli/issues/new) -- 2.47.2 From ddd46657722aa0ce34ef34dc66311c8a2725c86a Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 14 May 2021 04:32:04 +0500 Subject: [PATCH 097/133] Readme Clean up --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3621606..7587ca8 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# Bank of Maldives CLI -## BML CLI written in Bash. +# BML-CLI +## Bank Of Maldivces CLI client written in Bash. This project is currently under development and a lot of things are broken. ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) ## Getting Started ### Requirements `curl` `jq` `openssl` +- Termux users will need `ncurses-utils` additionally for terminal colors - Install with whatever package manager you use. - Make SURE all requirements are met before running script. -- Termux users will need `ncurses-utils` additionally for terminal colors #### Installation - GIT (Recommended) ``` @@ -17,7 +17,7 @@ cd bml-cli chmod +x bml.sh ./bml.sh ``` -#### Installation - Systemwide (NOT Recommended, May not work) +#### Installation - Systemwide (NOT Recommended, May not work on some distros) ``` curl -sSL https://install.bml-cli.shihaam.dev | sudo bash ``` -- 2.47.2 From d970c2688c7dad1b554dd993a87efae44aab8c1b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 14 May 2021 04:33:12 +0500 Subject: [PATCH 098/133] Readme Clean up --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7587ca8..9ee7927 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # BML-CLI ## Bank Of Maldivces CLI client written in Bash. -This project is currently under development and a lot of things are broken. ![photo_2021-04-28_14-59-35](https://user-images.githubusercontent.com/18140039/116385581-5c948300-a832-11eb-899b-9133501a4ae7.jpg) +This project is currently under development and a lot of things are broken. + ## Getting Started ### Requirements -- 2.47.2 From 82a7265e500abf01dfdd344e07959f0aa493d64a Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 15 May 2021 01:22:15 +0500 Subject: [PATCH 099/133] added down for maintenance error --- login.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/login.sh b/login.sh index a2ac390..19b1f0a 100644 --- a/login.sh +++ b/login.sh @@ -31,6 +31,11 @@ elif [ "$LOGIN" = "20" ] 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 -- 2.47.2 From 9a6e24450a510b5d7a00b8b09517f961196de6e7 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 17 May 2021 00:31:44 +0500 Subject: [PATCH 100/133] rewrite --- accounts.sh | 11 ------ addcontact-bml.sh | 47 ------------------------ addcontact-menu.sh | 40 --------------------- bml.sh | 33 ----------------- changepassword.sh | 90 ---------------------------------------------- contactsmenu.sh | 39 -------------------- deletecontact.sh | 17 --------- installer.sh | 10 ------ listcontacts.sh | 3 -- login.sh | 43 ---------------------- logout.sh | 5 --- mainmenu.sh | 57 ----------------------------- osdetect.sh | 26 -------------- readpass.sh | 32 ----------------- savepass.sh | 37 ------------------- settings-menu.sh | 34 ------------------ welcome.sh | 41 --------------------- 17 files changed, 565 deletions(-) delete mode 100644 accounts.sh delete mode 100644 addcontact-bml.sh delete mode 100644 addcontact-menu.sh delete mode 100755 bml.sh delete mode 100644 changepassword.sh delete mode 100644 contactsmenu.sh delete mode 100644 deletecontact.sh delete mode 100644 installer.sh delete mode 100644 listcontacts.sh delete mode 100644 login.sh delete mode 100644 logout.sh delete mode 100644 mainmenu.sh delete mode 100644 osdetect.sh delete mode 100644 readpass.sh delete mode 100644 savepass.sh delete mode 100644 settings-menu.sh delete mode 100644 welcome.sh 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 -- 2.47.2 From 7091ad43cc80cfcf87c98f53834754f85895afbf Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 17 May 2021 06:37:29 +0500 Subject: [PATCH 101/133] pain --- bml-cli.sh | 397 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 397 insertions(+) create mode 100644 bml-cli.sh diff --git a/bml-cli.sh b/bml-cli.sh new file mode 100644 index 0000000..ca4acf3 --- /dev/null +++ b/bml-cli.sh @@ -0,0 +1,397 @@ +#!/bin/sh + +cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 +CONFIG=~/.config/bml-cli/config +CREDENTIALS=~/.config/bml-cli/.credentials +COOKIE=~/.cache/bml-cli/.cookie +BML_RESETPASS='https://www.bankofmaldives.com.mv/internetbanking/forgot_password' + +#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` +# Colors +G='\e[01;32m' # GREEN TEXT +R='\e[01;31m' # RED TEXT +Y='\e[01;33m' # YELLOW TEXT +B='\e[01;34m' # BLUE TEXT +V='\e[01;35m' # VIOLET TEXT +Bl='\e[01;30m' # BLACK TEXT +C='\e[01;36m' # CYAN TEXT +W='\e[01;37m' # WHITE TEXT +BGBL='\e[1;30;47m' # Background W Text Bl +N='\e[0m' # How to use (example): echo "${G}example${N}" +loadBar=' ' # Load UI + +##Setting Up Funcations +initanimate(){ + PID=$! + h=0 + anim='⠋⠙⠴⠦' + while [ -d /proc/$PID ]; do + h=$(((h + 1) % 4)) + sleep 0.05 + printf "\r${@} [${anim:$h:1}]" + done + initbanner +} +animate(){ + PID=$! + h=0 + anim='⠋⠙⠴⠦' + while [ -d /proc/$PID ]; do + h=$(((h + 1) % 4)) + sleep 0.05 + printf "\r${@} [${anim:$h:1}]" + done + banner +} +initialize(){ + mkdir -p ~/.config/bml-cli/ + mkdir -p ~/.cache/bml-cli/ + echo "# DO NOT EDIT THIS MANUALLY!!" > $CREDENTIALS + echo "BML_USERNAME='' # Your encrypted BML Username" >> $CREDENTIALS + echo "BML_PASSWORD='' # Your encrypted BML Password" >> $CREDENTIALS + echo "# DO NOT EDIT THIS UNLESS NECESSARY!!" > $CONFIG + echo "I_AM_HYPOCRITE='false' # This is for MacOS Users ONLY" >> $CONFIG + echo "I_AM_SODU='false' # This is for WSL Users ONLY" >> $CONFIG + echo "" >> $CONFIG + echo "BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' # BML API URL " >> $CONFIG +} + +check_connection(){ + PING=$(ping www.bankofmaldives.com.mv -c 2 2> /dev/null | grep -oE 0%) + if [ "$PING" != "0%" ] ; then + echo ${red}Check your connection and try again.${reset} + exit + fi +} + +os_detect(){ + 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 + if [ "$I_AM_SODU" != "true" ] + then + echo ${red}Please check $CONFIG and configure accordingly.${reset} + exit + fi + elif [ "$MAC" = "Darwin" ] + then + OS=macos + export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" + if [ "$I_AM_HYPOCRITE" != "true" ] + then + echo ${red}Please check $CONFIG and configure accordingly.${reset} + exit + fi + elif [ "$ANDROID" = "Android" ] + then + OS=android + fi +} + +initbanner(){ +# clear + echo "${red}" + echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" + echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" + echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" + echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" + echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" + echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" + echo "${reset}" +} + +banner(){ +# clear + 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 "" +} + +readpin(){ + read -s -p 'Enter Pin: ' PIN + echo "" + BML_USERNAME_UNSAFE=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) + BML_PASSWORD_UNSAFE=$(echo ${BML_PASSWORD} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) + login +} +wipe_credentials(){ + sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='' # Your encrypted BML Username @" $CREDENTIALS + sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='' # Your encrypted BML Password @" $CREDENTIALS +} +urandom(){ + BML_USERNAME_UNSAFE=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) + BML_PASSWORD_UNSAFE=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) + 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) + REPEAT_PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) + PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) +} +savepass(){ + if [ "$BML_USERNAME" = "" ] && [ "$BML_PASSWORD" = "" ] + 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 New Pin: ' NEW_PIN + echo "" + read -s -p 'Repeat Pin: ' REPEAT_PIN + if [ "$NEW_PIN" = "$REPEAT_PIN" ] + then + echo "" + BML_USERNAME=$(echo "${BML_USERNAME_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) + BML_PASSWORD=$(echo "${BML_PASSWORD_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) + echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" + sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='${BML_USERNAME}' # Your encrypted BML Username @" $CREDENTIALS + sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='${BML_PASSWORD}' # Your encrypted BML Password @" $CREDENTIALS + else + echo "" + echo ${R}Pin do not match${N} + savepass + fi + else + echo Password not saved. + fi + else + : + fi + echo ok + #urandom & animate "${G}Randomzing Credentials${N}" && select_profile +} +login(){ + LOGIN=$(curl -s -c $COOKIE $BML_URL/login \ + --data-raw username=$BML_USERNAME_UNSAFE \ + --data-raw password=${BML_PASSWORD_UNSAFE} \ + | jq -r .code) + if [ "$LOGIN" = "0" ] + then + echo Login success + savepass + elif [ "$LOGIN" = "20" ] + then + account_locked + elif [ "$LOGIN" = "2" ] + then + echo Password or Username Incorrect + wipe_credentials + enter_credentials + 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 +} +account_locked(){ + 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 + enter_credentials +} + +enter_credentials(){ + #echo "" + read -p 'Username: ' BML_USERNAME_UNSAFE + read -s -p 'Password: ' BML_PASSWORD_UNSAFE + echo "" + login +} + +select_profile(){ +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(){ +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) +} +main_menu(){ +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 + banner && settings +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 +} + +settings(){ + echo "" + echo "Settings" + echo "" + echo "1 - bml-cli Settings" + echo "2 - BML Account Settings" + echo "3 - Go Back" + echo "" + printf 'Please Input: ' + read -r SETTINGS + + if [ "$SETTINGS" = "1" ] + then + logout + 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 +} +bml-cli_settings(){ + echo "" + echo "bml-cli Settings" + echo "" + echo "1 - Logout" + echo "2 - Logout and reset configration" + echo "3 - Exit" + echo "" + printf 'Please Input: ' + read -r BML-CLI_SETTINGS + if [ "$BML-CLI_SETTINGS" = "1" ] + then + logout + echo "Exit.." + exit + elif [ "$BML-CLI_SETTINGS" = "2" ] + then + reset_config && exit + elif [ "$BML-CLI_SETTINGS" = "3" ] + then + exit + fi +} +if [ ! -f $CONFIG ] +then + initialize +fi + +check_connection #& initanimate "Checking Internet Connection" +os_detect # & initanimate "Detecting Operating System" +source $CONFIG +source $CREDENTIALS +if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] +then + readpin +else + enter_credentials +fi +#userinfo +#banner && main_menu -- 2.47.2 From 3a27ebd51eab622e1de8d93f054fa9240c0db026 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 17 May 2021 07:11:13 +0500 Subject: [PATCH 102/133] can login --- bml-cli.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) mode change 100644 => 100755 bml-cli.sh diff --git a/bml-cli.sh b/bml-cli.sh old mode 100644 new mode 100755 index ca4acf3..3aad361 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 CONFIG=~/.config/bml-cli/config @@ -44,7 +44,7 @@ initanimate(){ sleep 0.05 printf "\r${@} [${anim:$h:1}]" done - initbanner + #initbanner } animate(){ PID=$! @@ -107,7 +107,7 @@ os_detect(){ } initbanner(){ -# clear + clear echo "${red}" echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" @@ -119,7 +119,7 @@ initbanner(){ } banner(){ -# clear + clear echo "${red}" echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" @@ -140,10 +140,13 @@ banner(){ readpin(){ read -s -p 'Enter Pin: ' PIN echo "" +#} +#decrypt_pin(){ BML_USERNAME_UNSAFE=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) BML_PASSWORD_UNSAFE=$(echo ${BML_PASSWORD} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) login } + wipe_credentials(){ sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='' # Your encrypted BML Username @" $CREDENTIALS sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='' # Your encrypted BML Password @" $CREDENTIALS @@ -167,9 +170,12 @@ savepass(){ read -s -p 'Repeat Pin: ' REPEAT_PIN if [ "$NEW_PIN" = "$REPEAT_PIN" ] then + #encrypt & initanimate "Encrypting Credentials" echo "" BML_USERNAME=$(echo "${BML_USERNAME_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) BML_PASSWORD=$(echo "${BML_PASSWORD_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) + encrypt_user & initanimate "Encrypting Username" + encrypt_pass & initanimate "Encrypting Password" echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='${BML_USERNAME}' # Your encrypted BML Username @" $CREDENTIALS sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='${BML_PASSWORD}' # Your encrypted BML Password @" $CREDENTIALS @@ -184,9 +190,17 @@ savepass(){ else : fi - echo ok - #urandom & animate "${G}Randomzing Credentials${N}" && select_profile + #echo ok + urandom & animate "${G}Randomzing Credentials${N}" && select_profile } +#encrypt(){ +# sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='${BML_USERNAME}' # Your encrypted BML Username @" $CREDENTIALS +# sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='${BML_PASSWORD}' # Your encrypted BML Password @" $CREDENTIALS +# BML_USERNAME=$(echo "${BML_USERNAME_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) +# BML_PASSWORD=$(echo "${BML_PASSWORD_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) +# echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" +# savepass +#} login(){ LOGIN=$(curl -s -c $COOKIE $BML_URL/login \ --data-raw username=$BML_USERNAME_UNSAFE \ @@ -383,8 +397,8 @@ then initialize fi -check_connection #& initanimate "Checking Internet Connection" -os_detect # & initanimate "Detecting Operating System" +check_connection & initanimate "Checking Internet Connection" +os_detect & initanimate "Detecting Operating System" source $CONFIG source $CREDENTIALS if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] @@ -393,5 +407,5 @@ then else enter_credentials fi -#userinfo -#banner && main_menu +userinfo +banner && main_menu -- 2.47.2 From f42ec3049dff7c0194f0031650ed736a45f7e537 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 17 May 2021 19:31:59 +0500 Subject: [PATCH 103/133] idekanymore --- bml-cli.sh | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 3aad361..404cbb6 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -71,11 +71,21 @@ initialize(){ } check_connection(){ + initbanner PING=$(ping www.bankofmaldives.com.mv -c 2 2> /dev/null | grep -oE 0%) - if [ "$PING" != "0%" ] ; then + if [ "$PING" != "0%" ] + then echo ${red}Check your connection and try again.${reset} exit fi + DOS=$(curl -s https://www.bankofmaldives.com.mv/ | grep -oE "error code: 1020") + if [ "$DOS" = "error code: 1020" ] + then + echo ${red}Access denied${reset} + echo Try again later + exit + fi + initbanner } os_detect(){ @@ -140,8 +150,12 @@ banner(){ readpin(){ read -s -p 'Enter Pin: ' PIN echo "" -#} -#decrypt_pin(){ + CHECK_PIN=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2 2>&1 | grep -oE bad) + if [ "$CHECK_PIN" = "bad bad" ] + then + echo ${R}Incorrect Pin${N} + readpin + fi BML_USERNAME_UNSAFE=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) BML_PASSWORD_UNSAFE=$(echo ${BML_PASSWORD} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) login @@ -346,13 +360,13 @@ settings(){ if [ "$SETTINGS" = "1" ] then - logout + banner && bml-cli_settings elif [ "$SETTINGS" = "2" ] then source changepassword.sh elif [ "$SETTINGS" = "3" ] || [ "$SETTINGS" = "back" ] then - source mainmenu.sh + banner && main_menu elif [ "$SETTINGS" = "clear" ] then sleep 0.2 @@ -375,21 +389,21 @@ bml-cli_settings(){ echo "" echo "1 - Logout" echo "2 - Logout and reset configration" - echo "3 - Exit" + echo "3 - Back" echo "" printf 'Please Input: ' - read -r BML-CLI_SETTINGS - if [ "$BML-CLI_SETTINGS" = "1" ] + read -r BML_CLI_SETTINGS + if [ "$BML_CLI_SETTINGS" = "1" ] then logout echo "Exit.." exit - elif [ "$BML-CLI_SETTINGS" = "2" ] + elif [ "$BML_CLI_SETTINGS" = "2" ] then reset_config && exit - elif [ "$BML-CLI_SETTINGS" = "3" ] + elif [ "$BML_CLI_SETTINGS" = "3" ] then - exit + banner && settings fi } if [ ! -f $CONFIG ] @@ -397,8 +411,8 @@ then initialize fi -check_connection & initanimate "Checking Internet Connection" -os_detect & initanimate "Detecting Operating System" +check_connection & initanimate "Checking Internet Connection" +os_detect #& initanimate "Detecting Operating System" source $CONFIG source $CREDENTIALS if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] -- 2.47.2 From 731a5684dfba7c6a60a170001b49bcaf295a224d Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 19 May 2021 23:11:47 +0500 Subject: [PATCH 104/133] idk --- bml-cli.sh | 274 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 201 insertions(+), 73 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 404cbb6..fe6a8d9 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -35,17 +35,6 @@ N='\e[0m' # How to use (example): echo "${G}example${N}" loadBar=' ' # Load UI ##Setting Up Funcations -initanimate(){ - PID=$! - h=0 - anim='⠋⠙⠴⠦' - while [ -d /proc/$PID ]; do - h=$(((h + 1) % 4)) - sleep 0.05 - printf "\r${@} [${anim:$h:1}]" - done - #initbanner -} animate(){ PID=$! h=0 @@ -55,7 +44,6 @@ animate(){ sleep 0.05 printf "\r${@} [${anim:$h:1}]" done - banner } initialize(){ mkdir -p ~/.config/bml-cli/ @@ -71,7 +59,6 @@ initialize(){ } check_connection(){ - initbanner PING=$(ping www.bankofmaldives.com.mv -c 2 2> /dev/null | grep -oE 0%) if [ "$PING" != "0%" ] then @@ -85,7 +72,6 @@ check_connection(){ echo Try again later exit fi - initbanner } os_detect(){ @@ -114,20 +100,9 @@ os_detect(){ then OS=android fi + banner } - -initbanner(){ - clear - echo "${red}" - echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" - echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" - echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" - echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" - echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" - echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" - echo "${reset}" -} - +################################################################## banner(){ clear echo "${red}" @@ -138,15 +113,20 @@ banner(){ echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" echo "${reset}" +} +display_welcome(){ + echo "" echo ${green}Welcome ${reset}$NAME echo "" +} +display_user_info(){ echo ${cyan}Phone${reset}: $PHONE echo ${cyan}Email${reset}: $EMAIL echo ${cyan}Birthday${reset}: $DOB echo ${cyan}ID Card${reset}: $IDCARD echo "" } - +#################################################################### readpin(){ read -s -p 'Enter Pin: ' PIN echo "" @@ -156,6 +136,7 @@ readpin(){ echo ${R}Incorrect Pin${N} readpin fi + banner BML_USERNAME_UNSAFE=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) BML_PASSWORD_UNSAFE=$(echo ${BML_PASSWORD} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) login @@ -184,12 +165,11 @@ savepass(){ read -s -p 'Repeat Pin: ' REPEAT_PIN if [ "$NEW_PIN" = "$REPEAT_PIN" ] then - #encrypt & initanimate "Encrypting Credentials" echo "" BML_USERNAME=$(echo "${BML_USERNAME_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) BML_PASSWORD=$(echo "${BML_PASSWORD_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) - encrypt_user & initanimate "Encrypting Username" - encrypt_pass & initanimate "Encrypting Password" + #encrypt_user #& initanimate "Encrypting Username" + #encrypt_pass #& initanimate "Encrypting Password" echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='${BML_USERNAME}' # Your encrypted BML Username @" $CREDENTIALS sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='${BML_PASSWORD}' # Your encrypted BML Password @" $CREDENTIALS @@ -204,17 +184,11 @@ savepass(){ else : fi - #echo ok - urandom & animate "${G}Randomzing Credentials${N}" && select_profile + urandom && select_profile } -#encrypt(){ -# sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='${BML_USERNAME}' # Your encrypted BML Username @" $CREDENTIALS -# sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='${BML_PASSWORD}' # Your encrypted BML Password @" $CREDENTIALS -# BML_USERNAME=$(echo "${BML_USERNAME_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) -# BML_PASSWORD=$(echo "${BML_PASSWORD_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) -# echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" -# savepass -#} +################################################################################################ + +################################################################################################ login(){ LOGIN=$(curl -s -c $COOKIE $BML_URL/login \ --data-raw username=$BML_USERNAME_UNSAFE \ @@ -222,14 +196,15 @@ login(){ | jq -r .code) if [ "$LOGIN" = "0" ] then - echo Login success + echo ${lightgreen}Login success${reset} savepass elif [ "$LOGIN" = "20" ] then account_locked elif [ "$LOGIN" = "2" ] then - echo Password or Username Incorrect + banner + echo ${red}Password or Username Incorrect${reset} wipe_credentials enter_credentials elif [ "$LOGIN" = "37" ] @@ -242,6 +217,9 @@ login(){ exit fi } +################################################################################################ + +################################################################################################ account_locked(){ echo "${red}Account Locked!${reset}" echo "${lightred}Please reset password and login again.${reset}" @@ -260,7 +238,9 @@ account_locked(){ fi enter_credentials } +################################################################################################ +################################################################################################ enter_credentials(){ #echo "" read -p 'Username: ' BML_USERNAME_UNSAFE @@ -268,7 +248,9 @@ enter_credentials(){ echo "" login } +################################################################################################ +################################################################################################ select_profile(){ REQPRO=$(curl -s -b $COOKIE $BML_URL/profile) PERSONALPROFILE=$(echo $REQPRO \ @@ -278,7 +260,9 @@ curl -s -b $COOKIE $BML_URL/profile \ --data-raw profile=$PERSONALPROFILE \ --compressed > /dev/null } +################################################################################################ +################################################################################################ userinfo(){ USERINFO=$(curl -s -b $COOKIE $BML_URL/userinfo | jq -r '.["payload"] | .["user"]') NAME=$(echo $USERINFO | jq -r .fullname) @@ -287,6 +271,106 @@ EMAIL=$(echo $USERINFO | jq -r .email) DOB=$(echo $USERINFO | jq -r .birthdate |cut -d 'T' -f 1) IDCARD=$(echo $USERINFO | jq -r .idcard) } +################################################################################################ + +################################################################################################ +accounts(){ + banner + curl -s -b $COOKIE $BML_URL/dashboard \ + | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' +} +################################################################################################ + +################################################################################################ +list_contacts(){ + echo $API_CONATCTS | jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' +} +################################################################################################ +api_contacts(){ + API_CONATCTS=$(curl -s -b $COOKIE $BML_URL/contacts) +} + +################################################################################################ +transfer(){ +# banner + accounts + echo "" + echo "Select debit account" + echo "Enter credit account" +} +################################################################################################ + +################################################################################################ +api_account(){ +API_ACCOUNT=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER) +} +################################################################################################ + +################################################################################################ +add_contact(){ +printf 'Account Number: ' +read -r ACCOUNT_NUMBER +api_account +VALID_NUMBER=$(echo $API_ACCOUNT | jq -r .success) + +if [ "$VALID_NUMBER" = "true" ] +then + + ACCOUNT_NAME=$(echo $API_ACCOUNT | jq -r '.["payload"] | .name') + CURRENCY=$(echo $API_ACCOUNT | 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}" + fi +else + echo "${red}Invalid Account${reset}" 1>&2 + add_contact +fi +} +################################################################################################ + +################################################################################################ +delete_contact(){ + 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 + contacts_menu + else + echo "${red}There was an error${reset}" + delete_contact + fi +} +################################################################################################ + +################################################################################################ main_menu(){ echo "Main Menu" echo "" @@ -302,19 +386,17 @@ read -r MENU if [ "$MENU" = "1" ] then - echo "WIP" - sleep 2 - #source mainmenu.sh - source accounts.sh + banner + accounts #& animate "Fetching account details" +# display_user_info + accounts_menu elif [ "$MENU" = "2" ] then - echo "WIP" - sleep 2 - source mainmenu.sh - #source transfer.sh -elif [ "$MENU" = "3" ] + banner + transfer_menu +elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ] then - source contactsmenu.sh + banner && api_contacts && list_contacts && contacts_menu elif [ "$MENU" = "4" ] then echo "WIP" @@ -342,13 +424,69 @@ elif [ "$MENU" = "exit" ] sleep 0.2 exit else + banner echo ${red}Invalid input:${yellow} $MENU ${reset} 1>&2 - source mainmenu.sh + main_menu fi } - -settings(){ +############################################################################################## +accounts_menu(){ + echo "Work In Progress" + read -p "Press Anykey to go main menu" BRUH + banner && display_welcome && display_user_info && main_menu +} +################################################################################################ +contacts_menu(){ + echo "Contacts" echo "" + echo "1 - Transfer" + echo "2 - Add New Contact" + echo "3 - Delete Contact" + echo "x - Go back" + echo "" + printf 'Please Input: ' +read -r CONTACTS + +if [ "$CONTACTS" = "1" ] +then + banner + transfer_menu +elif [ "$CONTACTS" = "2" ] +then + banner + add_contact + contacts_menu +elif [ "$CONTACTS" = "3" ] +then + banner + list_contacts + delete_contact + api_contacts + contact_menu +elif [ "$CONTACTS" = "x" ] || [ "$CONTACTS" = "back" ] +then + sleep 0.2 + banner + main_menu +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 +} +transfer_menu(){ + echo "Work In Progress" + read -p "Press Anykey to go main menu" BRUH + banner && display_user_info && main_menu +} + +################################################################################################ +settings(){ echo "Settings" echo "" echo "1 - bml-cli Settings" @@ -364,27 +502,17 @@ settings(){ elif [ "$SETTINGS" = "2" ] then source changepassword.sh - elif [ "$SETTINGS" = "3" ] || [ "$SETTINGS" = "back" ] + elif [ "$SETTINGS" = "x" ] || [ "$SETTINGS" = "back" ] then banner && main_menu - 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 + banner + display_user_info echo ${red}Invalid input:${yellow} $SETTINGS ${reset} 1>&2 - source settings-menu.sh + settings fi } bml-cli_settings(){ - echo "" echo "bml-cli Settings" echo "" echo "1 - Logout" @@ -411,8 +539,8 @@ then initialize fi -check_connection & initanimate "Checking Internet Connection" -os_detect #& initanimate "Detecting Operating System" +banner && check_connection #& animate "Checking Internet Connection" +banner && os_detect #& animate "Detecting Operating System" source $CONFIG source $CREDENTIALS if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] @@ -422,4 +550,4 @@ else enter_credentials fi userinfo -banner && main_menu +banner && display_welcome && display_user_info && main_menu -- 2.47.2 From 28afb928ddf690266496d346c66adc1f79383fa9 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 19 May 2021 23:32:03 +0500 Subject: [PATCH 105/133] promt to login if logged in from another app while using bml-cli --- bml-cli.sh | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index fe6a8d9..f70e2e4 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -152,7 +152,7 @@ urandom(){ 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) REPEAT_PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) - PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) + NEW_PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) } savepass(){ if [ "$BML_USERNAME" = "" ] && [ "$BML_PASSWORD" = "" ] @@ -184,7 +184,7 @@ savepass(){ else : fi - urandom && select_profile + select_profile # urandom && select_profile } ################################################################################################ @@ -283,11 +283,18 @@ accounts(){ ################################################################################################ list_contacts(){ - echo $API_CONATCTS | jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' + echo $API_CONATACTS | jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' } ################################################################################################ api_contacts(){ - API_CONATCTS=$(curl -s -b $COOKIE $BML_URL/contacts) + API_CONATACTS=$(curl -s -b $COOKIE $BML_URL/contacts) + SUCCESS=$(echo $API_CONATACTS | jq -r .success) + if [ "$SUCCESS" != "true" ] + then + echo "Login Required" + init_login + api_contacts + fi } ################################################################################################ @@ -539,15 +546,18 @@ then initialize fi -banner && check_connection #& animate "Checking Internet Connection" -banner && os_detect #& animate "Detecting Operating System" +init_login(){ + if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] + then + readpin + else + enter_credentials + fi +} +banner && check_connection & animate "Checking Internet Connection" +banner && os_detect & animate "Detecting Operating System" source $CONFIG source $CREDENTIALS -if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] -then - readpin -else - enter_credentials -fi +banner && init_login userinfo banner && display_welcome && display_user_info && main_menu -- 2.47.2 From 1565c14aa8cd00a87c4eb812f29ff415de716656 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 00:08:24 +0500 Subject: [PATCH 106/133] promt to login if logged in from another app while using bml-cli - dashboard --- bml-cli.sh | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index f70e2e4..8c17313 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -264,22 +264,41 @@ curl -s -b $COOKIE $BML_URL/profile \ ################################################################################################ userinfo(){ -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) + USERINFO=$(curl -s -b $COOKIE $BML_URL/userinfo) + SUCCESS=$(echo $USERINFO | jq -r .success) + if [ "$SUCCESS" != "true" ] + then + echo "Login Required" + init_login + banner + userinfo + fi + USERINFO=$(echo $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) } ################################################################################################ ################################################################################################ accounts(){ - banner curl -s -b $COOKIE $BML_URL/dashboard \ | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' } ################################################################################################ +api_dashboard(){ + API_DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard) + SUCCESS=$(echo $API_CONATACTS | jq -r .success) + if [ "$SUCCESS" != "true" + then + echo "Login Required" + init_login + banner + api_dashboard + fi +} ################################################################################################ list_contacts(){ @@ -293,6 +312,7 @@ api_contacts(){ then echo "Login Required" init_login + banner api_contacts fi } @@ -394,6 +414,7 @@ read -r MENU if [ "$MENU" = "1" ] then banner + api_dashboard accounts #& animate "Fetching account details" # display_user_info accounts_menu -- 2.47.2 From 0799b0764fc26f4ab742664006739975183778fa Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 00:44:47 +0500 Subject: [PATCH 107/133] promt to login if logged in from another app while using bml-cli - dashboard --- bml-cli.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 8c17313..477a55e 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -200,7 +200,13 @@ login(){ savepass elif [ "$LOGIN" = "20" ] then + banner account_locked + sleep 1.5 + banner + echo "${red}Account Locked!${reset}" + echo "${lightred}Please reset password and login again.${reset}" + enter_credentials elif [ "$LOGIN" = "2" ] then banner @@ -221,9 +227,6 @@ login(){ ################################################################################################ account_locked(){ - echo "${red}Account Locked!${reset}" - echo "${lightred}Please reset password and login again.${reset}" - echo "" if [ "$OS" = "macos" ] then open $BML_RESETPASS @@ -236,7 +239,6 @@ account_locked(){ else xdg-open $BML_RESETPASS fi - enter_credentials } ################################################################################################ @@ -284,14 +286,14 @@ userinfo(){ ################################################################################################ accounts(){ - curl -s -b $COOKIE $BML_URL/dashboard \ + echo $API_DASHBOARD \ | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' } ################################################################################################ api_dashboard(){ API_DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard) - SUCCESS=$(echo $API_CONATACTS | jq -r .success) - if [ "$SUCCESS" != "true" + SUCCESS=$(echo $API_DASHBOARD | jq -r .success) + if [ "$SUCCESS" != "true" ] then echo "Login Required" init_login -- 2.47.2 From ca2fa8c194cd01c807b33182b6c0245c79f5d5a8 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 04:33:26 +0500 Subject: [PATCH 108/133] nice contacts --- a.out | 0 bml-cli.sh | 219 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 126 insertions(+), 93 deletions(-) create mode 100644 a.out diff --git a/a.out b/a.out new file mode 100644 index 0000000..e69de29 diff --git a/bml-cli.sh b/bml-cli.sh index 477a55e..08e1571 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -42,7 +42,7 @@ animate(){ while [ -d /proc/$PID ]; do h=$(((h + 1) % 4)) sleep 0.05 - printf "\r${@} [${anim:$h:1}]" + printf "\r${@} [${anim:$h:1}]" done } initialize(){ @@ -63,7 +63,7 @@ check_connection(){ if [ "$PING" != "0%" ] then echo ${red}Check your connection and try again.${reset} - exit + exit 1 fi DOS=$(curl -s https://www.bankofmaldives.com.mv/ | grep -oE "error code: 1020") if [ "$DOS" = "error code: 1020" ] @@ -85,7 +85,7 @@ os_detect(){ if [ "$I_AM_SODU" != "true" ] then echo ${red}Please check $CONFIG and configure accordingly.${reset} - exit + cexit fi elif [ "$MAC" = "Darwin" ] then @@ -94,7 +94,7 @@ os_detect(){ if [ "$I_AM_HYPOCRITE" != "true" ] then echo ${red}Please check $CONFIG and configure accordingly.${reset} - exit + cexit fi elif [ "$ANDROID" = "Android" ] then @@ -103,7 +103,7 @@ os_detect(){ banner } ################################################################## -banner(){ +display_banner(){ clear echo "${red}" echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" @@ -115,11 +115,14 @@ banner(){ echo "${reset}" } display_welcome(){ - echo "" echo ${green}Welcome ${reset}$NAME echo "" } -display_user_info(){ +display_name(){ + echo "" + echo ${cyan}Name${reset}: $NAME +} +display_userinfo(){ echo ${cyan}Phone${reset}: $PHONE echo ${cyan}Email${reset}: $EMAIL echo ${cyan}Birthday${reset}: $DOB @@ -127,6 +130,13 @@ display_user_info(){ echo "" } #################################################################### +cexit(){ + echo "Cleaning up.." + rm $COOKIE + sleep 0.2 + exit +} + readpin(){ read -s -p 'Enter Pin: ' PIN echo "" @@ -136,10 +146,11 @@ readpin(){ echo ${R}Incorrect Pin${N} readpin fi - banner + #banner BML_USERNAME_UNSAFE=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) BML_PASSWORD_UNSAFE=$(echo ${BML_PASSWORD} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) - login + #banner + login #& animate "Logging in" } wipe_credentials(){ @@ -184,7 +195,8 @@ savepass(){ else : fi - select_profile # urandom && select_profile + urandom + select_profile #& animate "Selecting Profile" # urandom && select_profile } ################################################################################################ @@ -196,20 +208,21 @@ login(){ | jq -r .code) if [ "$LOGIN" = "0" ] then + display_banner echo ${lightgreen}Login success${reset} savepass elif [ "$LOGIN" = "20" ] then - banner + display_banner account_locked sleep 1.5 - banner + display_banner echo "${red}Account Locked!${reset}" echo "${lightred}Please reset password and login again.${reset}" enter_credentials elif [ "$LOGIN" = "2" ] then - banner + display_banner echo ${red}Password or Username Incorrect${reset} wipe_credentials enter_credentials @@ -270,9 +283,9 @@ userinfo(){ SUCCESS=$(echo $USERINFO | jq -r .success) if [ "$SUCCESS" != "true" ] then - echo "Login Required" + echo ${red}Login Required${reset} init_login - banner + display_banner userinfo fi USERINFO=$(echo $USERINFO | jq -r '.["payload"] | .["user"]') @@ -286,35 +299,35 @@ userinfo(){ ################################################################################################ accounts(){ - echo $API_DASHBOARD \ - | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' + echo $DASHBOARD | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' } ################################################################################################ api_dashboard(){ - API_DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard) - SUCCESS=$(echo $API_DASHBOARD | jq -r .success) + DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard) + SUCCESS=$(echo $DASHBOARD | jq -r .success) if [ "$SUCCESS" != "true" ] then - echo "Login Required" + echo ${red}Login Required${reset} init_login - banner + display_banner && display_name && display_userinfo api_dashboard fi } ################################################################################################ list_contacts(){ - echo $API_CONATACTS | jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' + echo $API_CONATACTS | jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["​​===========","==============","========","=============================","============================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K } ################################################################################################ api_contacts(){ API_CONATACTS=$(curl -s -b $COOKIE $BML_URL/contacts) - SUCCESS=$(echo $API_CONATACTS | jq -r .success) - if [ "$SUCCESS" != "true" ] + SUCCESS=$(echo $API_CONATACTS | jq -r .code) + if [ "$SUCCESS" = "17" ] then - echo "Login Required" + echo ${red}Login Required${reset} init_login - banner + display_banner && display_name && display_userinfo api_contacts fi } @@ -331,14 +344,34 @@ transfer(){ ################################################################################################ api_account(){ -API_ACCOUNT=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER) + API_ACCOUNT=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER) + SUCCESS=$(echo $API_ACCOUNT | jq -r .code) + if [ "$SUCCESS" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner && display_name && display_userinfo + fi } ################################################################################################ ################################################################################################ add_contact(){ -printf 'Account Number: ' -read -r ACCOUNT_NUMBER + printf 'Account Number: ' + read -r ACCOUNT_NUMBER + + if [ "$ACCOUNT_NUMBER" = "x" ] || [ "$ACCOUNT_NUMBER" = "back" ] + then + display_banner && display_name && display_userinfo + contacts_menu + elif [ "$ACCOUNT_NUMBER" = "" ] + then + display_banner && display_name && display_userinfo + echo ${red}No input${reset} + echo Input account number or ${lightgreen}x${reset} to go back + add_contact + fi + api_account VALID_NUMBER=$(echo $API_ACCOUNT | jq -r .success) @@ -355,21 +388,26 @@ then if [ "$CONTACT_NAME" = "" ] then CONTACT_NAME=$ACCOUNT_NAME - else - : fi - CONTACT_NAME=`echo "$CONTACT_NAME" | sed "s/ /%20/"` + CONTACT_NAME_SED=`echo "$CONTACT_NAME" | sed "s/ /%20/g"` ADDCONTACT=$(curl -s -b $COOKIE $BML_URL/contacts \ --data-raw contact_type=IAT \ --data-raw account=$ACCOUNT_NUMBER \ - --data-raw alias=$CONTACT_NAME \ + --data-raw alias=$CONTACT_NAME_SED \ --compressed \ - | jq -r .success) + | jq -r .code) - if [ "$ADDCONTACT" = "true" ] + if [ "$ADDCONTACT" = "0" ] then - echo "Contact added successfully" + display_banner && display_name && display_userinfo + echo $ACCOUNT_NUMBER ${lightgreen}saved as ${reset} $CONTACT_NAME ${lightgreen}succesfully${reset} + elif [ "$ADDCONTACT" = "17" ] + then + echo ${red}Login Required ${reset} + init_login + add_contact else + display_banner && display_name && display_userinfo echo "${red}There was an error${reset}" fi else @@ -415,46 +453,42 @@ read -r MENU if [ "$MENU" = "1" ] then - banner - api_dashboard - accounts #& animate "Fetching account details" -# display_user_info + display_banner + api_dashboard # & animate "Fetching account details" + display_banner + accounts accounts_menu elif [ "$MENU" = "2" ] then - banner + display_banner && display_name && display_userinfo transfer_menu elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ] then - banner && api_contacts && list_contacts && contacts_menu + display_banner && display_name && display_userinfo + api_contacts #& animate "Fetching contacts" + #display_banner + list_contacts + contacts_menu elif [ "$MENU" = "4" ] then echo "WIP" sleep 2 source mainmenu.sh source activities.sh -elif [ "$MENU" = "5" ] + elif [ "$MENU" = "5" ] then - echo "WIP" - sleep 2 - source mainmenu.sh - source services.sh -elif [ "$MENU" = "6" ] + echo "WIP" + sleep 2 + cexit + elif [ "$MENU" = "6" ] then - banner && settings -elif [ "$MENU" = "clear" ] + display_banner && display_name && display_userinfo + settings + elif [ "$MENU" = "exit" ] then - clear - sleep 0.2 - source mainmenu.sh -elif [ "$MENU" = "exit" ] - then - echo "cleaning up..." - rm $COOKIE - sleep 0.2 - exit -else - banner + cexit + else + display_banner && display_name && display_userinfo echo ${red}Invalid input:${yellow} $MENU ${reset} 1>&2 main_menu fi @@ -463,7 +497,8 @@ fi accounts_menu(){ echo "Work In Progress" read -p "Press Anykey to go main menu" BRUH - banner && display_welcome && display_user_info && main_menu + display_banner && display_name && display_userinfo + main_menu } ################################################################################################ contacts_menu(){ @@ -477,91 +512,89 @@ contacts_menu(){ printf 'Please Input: ' read -r CONTACTS -if [ "$CONTACTS" = "1" ] +if [ "$CONTACTS" = "1" ] || ["$CONTACTS" = "transfer" ] then - banner + display_banner && display_name && display_userinfo transfer_menu -elif [ "$CONTACTS" = "2" ] +elif [ "$CONTACTS" = "2" ] || ["$CONTACTS" = "add new contact" ] then - banner + display_banner && display_name && display_userinfo add_contact contacts_menu -elif [ "$CONTACTS" = "3" ] +elif [ "$CONTACTS" = "3" ] || ["$CONTACTS" = "delete contact" ] then - banner + display_banner && display_name && display_userinfo list_contacts delete_contact api_contacts contact_menu elif [ "$CONTACTS" = "x" ] || [ "$CONTACTS" = "back" ] then - sleep 0.2 - banner + display_banner && display_name && display_userinfo main_menu elif [ "$CONTACTS" = "exit" ] then - echo "Cleaning up.." - rm $COOKIE - sleep 0.2 - exit + cexit else + display_banner && display_name && display_userinfo echo ${red}Invalid input:${yellow} $CONTACTS ${reset} 1>&2 - source contactsmenu.sh + contacts_menu fi } transfer_menu(){ echo "Work In Progress" read -p "Press Anykey to go main menu" BRUH - banner && display_user_info && main_menu + display_banner && display_name && display_userinfo + main_menu } ################################################################################################ settings(){ echo "Settings" - echo "" echo "1 - bml-cli Settings" echo "2 - BML Account Settings" - echo "3 - Go Back" + echo "x - Go Back" echo "" printf 'Please Input: ' read -r SETTINGS if [ "$SETTINGS" = "1" ] then - banner && bml-cli_settings + display_banner && display_name && display_userinfo + bml-cli_settings elif [ "$SETTINGS" = "2" ] then source changepassword.sh elif [ "$SETTINGS" = "x" ] || [ "$SETTINGS" = "back" ] then - banner && main_menu + display_banner && display_name && display_userinfo + main_menu else - banner - display_user_info + display_banner && display_name && display_userinfo echo ${red}Invalid input:${yellow} $SETTINGS ${reset} 1>&2 settings fi } bml-cli_settings(){ echo "bml-cli Settings" - echo "" echo "1 - Logout" echo "2 - Logout and reset configration" - echo "3 - Back" + echo "x - Back" echo "" printf 'Please Input: ' read -r BML_CLI_SETTINGS if [ "$BML_CLI_SETTINGS" = "1" ] then logout - echo "Exit.." - exit + cexit elif [ "$BML_CLI_SETTINGS" = "2" ] then - reset_config && exit - elif [ "$BML_CLI_SETTINGS" = "3" ] + reset_config + cexit + elif [ "$BML_CLI_SETTINGS" = "x" ] || [ "$BML_CLI_SETTINGS" = "back" ] then - banner && settings + display_banner && display_name && display_userinfo + settings fi } if [ ! -f $CONFIG ] @@ -577,10 +610,10 @@ init_login(){ enter_credentials fi } -banner && check_connection & animate "Checking Internet Connection" -banner && os_detect & animate "Detecting Operating System" +display_banner && check_connection #& animate "Checking Internet Connection" +display_banner && os_detect # & animate "Detecting Operating System" source $CONFIG source $CREDENTIALS -banner && init_login +display_banner && init_login userinfo -banner && display_welcome && display_user_info && main_menu +display_banner && display_welcome && display_userinfo && main_menu -- 2.47.2 From 094ffc86f3710417c73c478789dca235ab428020 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 05:04:03 +0500 Subject: [PATCH 109/133] added password change --- bml-cli.sh | 130 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 28 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 08e1571..985f60f 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -547,24 +547,118 @@ transfer_menu(){ display_banner && display_name && display_userinfo main_menu } +########################################################################################### +change_password(){ + 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 .code) + + if [ "$OLDPASSCHECHECK" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner && display_name && display_userinfo + change_password + 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 .code) + + if [ "$PASSCHANGED" = "0" ] + then + echo "${red}Failed to change password${reset}" + else + echo "${lightgreen}Password changed succesfully ${reset}" + fi +} +############################################################################################## + ################################################################################################ settings(){ echo "Settings" - echo "1 - bml-cli Settings" - echo "2 - BML Account Settings" - echo "x - Go Back" + echo "1 - Logout" + echo "2 - Logout and reset config" + echo "3 - Change Password" echo "" printf 'Please Input: ' read -r SETTINGS if [ "$SETTINGS" = "1" ] then - display_banner && display_name && display_userinfo - bml-cli_settings + display_banner + logout elif [ "$SETTINGS" = "2" ] then - source changepassword.sh + display_banner + reset_config + elif [ "$SETTINGS" = "3" ] + then + display_banner && display_name && display_userinfo + change_password elif [ "$SETTINGS" = "x" ] || [ "$SETTINGS" = "back" ] then display_banner && display_name && display_userinfo @@ -575,28 +669,8 @@ settings(){ settings fi } -bml-cli_settings(){ - echo "bml-cli Settings" - echo "1 - Logout" - echo "2 - Logout and reset configration" - echo "x - Back" - echo "" - printf 'Please Input: ' - read -r BML_CLI_SETTINGS - if [ "$BML_CLI_SETTINGS" = "1" ] - then - logout - cexit - elif [ "$BML_CLI_SETTINGS" = "2" ] - then - reset_config - cexit - elif [ "$BML_CLI_SETTINGS" = "x" ] || [ "$BML_CLI_SETTINGS" = "back" ] - then - display_banner && display_name && display_userinfo - settings - fi -} + + if [ ! -f $CONFIG ] then initialize -- 2.47.2 From fce2ff1738cad08ae27b05afcc4802c73a366b36 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 06:17:12 +0500 Subject: [PATCH 110/133] activites --- bml-cli.sh | 144 +++++++++++++++++++++++++++-------------------------- 1 file changed, 73 insertions(+), 71 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 985f60f..3b8bcf4 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -436,7 +436,10 @@ delete_contact(){ fi } ################################################################################################ +activities(){ +curl -s -b $COOKIE $BML_URL/activities?page=1 | jq +} ################################################################################################ main_menu(){ echo "Main Menu" @@ -451,30 +454,27 @@ echo "" printf 'Please Input: ' read -r MENU -if [ "$MENU" = "1" ] + if [ "$MENU" = "1" ] then - display_banner - api_dashboard # & animate "Fetching account details" - display_banner - accounts - accounts_menu -elif [ "$MENU" = "2" ] + display_banner + api_dashboard # & animate "Fetching account details" + display_banner + accounts + accounts_menu + elif [ "$MENU" = "2" ] then - display_banner && display_name && display_userinfo - transfer_menu -elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ] + display_banner && display_name && display_userinfo + transfer_menu + elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ] then - display_banner && display_name && display_userinfo - api_contacts #& animate "Fetching contacts" - #display_banner - list_contacts - contacts_menu -elif [ "$MENU" = "4" ] + display_banner && display_name && display_userinfo + api_contacts #& animate "Fetching contacts" + list_contacts + contacts_menu + elif [ "$MENU" = "4" ] then - echo "WIP" - sleep 2 - source mainmenu.sh - source activities.sh + display_banner && display_name && display_userinfo + activities elif [ "$MENU" = "5" ] then echo "WIP" @@ -549,26 +549,6 @@ transfer_menu(){ } ########################################################################################### change_password(){ - 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" @@ -579,60 +559,81 @@ change_password(){ if [ "$OTPCHANNEL" = "1" ] || [ "$OTPCHANNEL" = "mobile" ] then OTPCHANNEL=mobile + ECHOOTPCHANNEL=$PHONE break elif [ "$OTPCHANNEL" = "2" ] || [ "$OTPCHANNEL" = "email" ] then OTPCHANNEL=email + ECHOOTPCHANNEL=$EMAIL break else + display_banner && display_name && display_userinfo 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 .code) - - if [ "$OLDPASSCHECHECK" = "17" ] - then - echo ${red}Login Required${reset} - init_login - display_banner && display_name && display_userinfo - change_password - fi - - if [ "$OTPCHANNEL" = "mobile" ] - then - ECHOOTPCHANNEL=$PHONE - elif [ "$OTPCHANNEL" = "email" ] - then - ECHOOTPCHANNEL=$EMAIL - fi + read -s -p 'Enter Current Password: ' OLD_PASSWORD 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 + display_banner && display_name && display_userinfo + echo "${red}Password do not match${reset}" + echo "Try again" + else + break + fi + done + + + 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 > /dev/null + echo ${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset} read -p 'Enter OTP: ' OTP - echo "" - PASSCHANGED=$(curl -s -b $COOKIE $BML_URL/user/changepassword \ + CHANGEPASSWORD=$(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 .code) - if [ "$PASSCHANGED" = "0" ] + if [ "$CHANGEPASSWORD" = "0" ] then - echo "${red}Failed to change password${reset}" + echo Password changed succesfully ${reset} + elif [ "$CHANGEPASSWORD" = "8" ] + then + display_banner && display_name && display_userinfo + echo ${red}Old Password is incorrect${reset} + echo failed to change password + change_password + elif [ "$CHANGEPASSWORD" = "24" ] + then + display_banner && display_name && display_userinfo + echo ${red}Invalid OTP${reset} + echo failed to change password + change_password + elif [ "$CHANGEPASSWORD" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner + change_password else - echo "${lightgreen}Password changed succesfully ${reset}" + echo unknown error + main_menu fi + + } ############################################################################################## @@ -650,7 +651,8 @@ settings(){ if [ "$SETTINGS" = "1" ] then display_banner - logout + wipe_credentials + cexit elif [ "$SETTINGS" = "2" ] then display_banner -- 2.47.2 From 37c2cb504acd23c7cb1589251bafd351cb843e27 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 06:19:47 +0500 Subject: [PATCH 111/133] activites --- a.out | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 a.out diff --git a/a.out b/a.out deleted file mode 100644 index e69de29..0000000 -- 2.47.2 From f78876b2a61bb9b5d798c97c62a75ac6e5cb94d0 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 06:22:54 +0500 Subject: [PATCH 112/133] added installer --- installer.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 installer.sh diff --git a/installer.sh b/installer.sh new file mode 100644 index 0000000..7e1282d --- /dev/null +++ b/installer.sh @@ -0,0 +1,10 @@ +#!/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-cli.sh" >> /usr/bin/bml-cli +chmod 755 /usr/bin/bml-cli +rm -rf bml-cli/ +echo "Installation Complete" -- 2.47.2 From 74b62ae824ebacbbe9e4fc1969a47fc6879212bc Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 08:13:20 +0500 Subject: [PATCH 113/133] added activites --- 63 | 0 bml-cli.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 63 diff --git a/63 b/63 new file mode 100644 index 0000000..e69de29 diff --git a/bml-cli.sh b/bml-cli.sh index 3b8bcf4..88ef726 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -435,10 +435,51 @@ delete_contact(){ delete_contact fi } +################################# +api_activites(){ + API_ACTIVITES=$(curl -s -b $COOKIE $BML_URL/activities) + SUCCESS=$(echo $API_ACTIVITES | jq -r .code) + if [ "$SUCCESS" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner && display_name && display_userinfo + api_activites + fi + PAGETOTAL=$(echo $API_ACTIVITES | jq -r '.payload | .content | .last_page') + +} ################################################################################################ activities(){ -curl -s -b $COOKIE $BML_URL/activities?page=1 | jq - + echo Current Page: 1 + echo $API_ACTIVITES | jq -r '["Type","Date","Contact","Amount","Remarks","Status"], ["=====","=========","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + while true; do + echo "" + echo Total Pages: $PAGETOTAL + read -p "Enter Page Number: " PAGENO + if [ "$PAGENO" = "" ] + then + display_banner && display_name && display_userinfo + echo ${red}Invalid Input${reset} + echo Enter x to go back + elif [ "$PAGENO" -le "$PAGETOTAL" ] + then + display_banner && display_name && display_userinfo + echo Current Page: $PAGENO + curl -s -b $COOKIE $BML_URL/activities?page=$PAGENO \ + | jq -r '["Type","Date","Contact","Amount","Remarks","Status"], ["=====","=========","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + elif [ "$PAGENO" -gt "$PAGETOTAL" ] + then + display_banner && display_name && display_userinfo + echo ${red}value too high${reset} + elif [ "$PAGENO" = "x" ] + then + display_banner && display_name && display_userinfo + main_menu + fi + done } ################################################################################################ main_menu(){ @@ -474,6 +515,7 @@ read -r MENU elif [ "$MENU" = "4" ] then display_banner && display_name && display_userinfo + api_activites activities elif [ "$MENU" = "5" ] then -- 2.47.2 From 0ebc8362f07f1c84ec54c18d16f8aa6d5e426c8a Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 08:58:39 +0500 Subject: [PATCH 114/133] nice accounts, bug fixes --- bml-cli.sh | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 88ef726..322f9c2 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -46,6 +46,7 @@ animate(){ done } initialize(){ + echo initalizing.. mkdir -p ~/.config/bml-cli/ mkdir -p ~/.cache/bml-cli/ echo "# DO NOT EDIT THIS MANUALLY!!" > $CREDENTIALS @@ -132,16 +133,31 @@ display_userinfo(){ #################################################################### cexit(){ echo "Cleaning up.." - rm $COOKIE + rm $COOKIE 2> /dev/null sleep 0.2 exit } +reset_config(){ + read -p 'Are you sure: [y/N]' SURE + if [ "$SURE" = "y" ] || [ "$SURE" = "Y" ] + then + display_banner + sleep 0.5 + echo Deleting Configration.... & rm -rf ~/.config/bml-cli + sleep 0.5 + echo Deleting Credentials.... & rm -rf ~/.cache/bml-cli + cexit + else + display_banner && display_name && display_userinfo + settings + fi +} readpin(){ read -s -p 'Enter Pin: ' PIN echo "" CHECK_PIN=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2 2>&1 | grep -oE bad) - if [ "$CHECK_PIN" = "bad bad" ] + if [ "$CHECK_PIN" = "bad bad" ] then echo ${R}Incorrect Pin${N} readpin @@ -299,7 +315,9 @@ userinfo(){ ################################################################################################ accounts(){ - echo $DASHBOARD | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' + echo $DASHBOARD \ + | jq -r '["Account Name"," Account Number","Type", "Currency", "Balance"], ["===================","==============","==================","=========","========="], (.payload | .dashboard |.[] | [.alias, .account, .product, .currency, .availableBalance]) | @tsv' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K } ################################################################################################ api_dashboard(){ @@ -481,6 +499,13 @@ activities(){ fi done } +services(){ + echo "" + echo "Work In Progress" + read -p "Press enter to return to main menu" BRUH + display_banner && display_name && display_userinfo + main_menu +} ################################################################################################ main_menu(){ echo "Main Menu" @@ -497,9 +522,8 @@ read -r MENU if [ "$MENU" = "1" ] then - display_banner api_dashboard # & animate "Fetching account details" - display_banner + display_banner && display_name && display_userinfo accounts accounts_menu elif [ "$MENU" = "2" ] @@ -519,14 +543,13 @@ read -r MENU activities elif [ "$MENU" = "5" ] then - echo "WIP" - sleep 2 - cexit + display_banner && display_name && display_userinfo + services elif [ "$MENU" = "6" ] then display_banner && display_name && display_userinfo settings - elif [ "$MENU" = "exit" ] + elif [ "$MENU" = "exit" ] || [ "$MENU" = "x" ] then cexit else @@ -537,8 +560,9 @@ fi } ############################################################################################## accounts_menu(){ + echo "" echo "Work In Progress" - read -p "Press Anykey to go main menu" BRUH + read -p "Press enter to return main menu" BRUH display_banner && display_name && display_userinfo main_menu } @@ -585,7 +609,7 @@ fi } transfer_menu(){ echo "Work In Progress" - read -p "Press Anykey to go main menu" BRUH + read -p "Press enter to return to main menu" BRUH display_banner && display_name && display_userinfo main_menu } @@ -608,9 +632,14 @@ change_password(){ OTPCHANNEL=email ECHOOTPCHANNEL=$EMAIL break + elif [ "$OTPCHANNEL" = "back" ] || [ "$OTPCHANNEL" = "x" ] + then + display_banner && display_name && display_userinfo + settings else display_banner && display_name && display_userinfo echo ${red}Invalid Input${reset} + echo Enter x to back fi done -- 2.47.2 From f523d0baeacdd33797c51c9bdd3a1a6e36daf33f Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 09:03:34 +0500 Subject: [PATCH 115/133] wrong pin bug --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9ee7927..cad6fa7 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,5 @@ curl -sSL https://install.bml-cli.shihaam.dev | sudo bash ``` ## Bugs +- Throw unknown error when wrong pin entered - [You tell me :)](https://github.com/shihaamabr/bml-cli/issues/new) -- 2.47.2 From e26f1b0611cd3f10b1e75da3b55adfda7966323c Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 09:10:40 +0500 Subject: [PATCH 116/133] fix termux ping --- bml-cli.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bml-cli.sh b/bml-cli.sh index 322f9c2..572d54e 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -60,7 +60,7 @@ initialize(){ } check_connection(){ - PING=$(ping www.bankofmaldives.com.mv -c 2 2> /dev/null | grep -oE 0%) + PING=$(ping -c 1 www.bankofmaldives.com.mv 2> /dev/null | grep -oE 0%) if [ "$PING" != "0%" ] then echo ${red}Check your connection and try again.${reset} -- 2.47.2 From ff4ae6c8472d75ed02367adc90401c94c6381f4c Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 09:13:11 +0500 Subject: [PATCH 117/133] perl...oog --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cad6fa7..04c4af1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This project is currently under development and a lot of things are broken. ## Getting Started ### Requirements -`curl` `jq` `openssl` +`curl` `jq` `openssl` `perl` - Termux users will need `ncurses-utils` additionally for terminal colors - Install with whatever package manager you use. - Make SURE all requirements are met before running script. -- 2.47.2 From 458e7ca98fdd57931db28be19c8e47e4ccc3a6e2 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 20 May 2021 09:31:27 +0500 Subject: [PATCH 118/133] bruh moment, wsl and mac users --- bml-cli.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bml-cli.sh b/bml-cli.sh index 572d54e..badae41 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -758,9 +758,9 @@ init_login(){ fi } display_banner && check_connection #& animate "Checking Internet Connection" -display_banner && os_detect # & animate "Detecting Operating System" source $CONFIG source $CREDENTIALS +display_banner && os_detect # & animate "Detecting Operating System" display_banner && init_login userinfo display_banner && display_welcome && display_userinfo && main_menu -- 2.47.2 From 08a4d544e4dfea67dd536c48565f196b794da6f6 Mon Sep 17 00:00:00 2001 From: fISHIE <83373559+WhoIsFishie@users.noreply.github.com> Date: Thu, 20 May 2021 15:35:49 +0500 Subject: [PATCH 119/133] Fixed Typo --- bml-cli.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bml-cli.sh b/bml-cli.sh index badae41..f31e519 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -34,7 +34,7 @@ BGBL='\e[1;30;47m' # Background W Text Bl N='\e[0m' # How to use (example): echo "${G}example${N}" loadBar=' ' # Load UI -##Setting Up Funcations +##Setting Up Functions animate(){ PID=$! h=0 -- 2.47.2 From 06aebb1eb2a095dfa6564a7c965c5ca98f525f95 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 00:38:42 +0500 Subject: [PATCH 120/133] fix invalid input in activites menu --- bml-cli.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index badae41..c160834 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -476,12 +476,8 @@ activities(){ echo "" echo Total Pages: $PAGETOTAL read -p "Enter Page Number: " PAGENO - if [ "$PAGENO" = "" ] - then - display_banner && display_name && display_userinfo - echo ${red}Invalid Input${reset} - echo Enter x to go back - elif [ "$PAGENO" -le "$PAGETOTAL" ] + + if [ "$PAGENO" -le "$PAGETOTAL" ] then display_banner && display_name && display_userinfo echo Current Page: $PAGENO @@ -496,6 +492,10 @@ activities(){ then display_banner && display_name && display_userinfo main_menu + else + display_banner && display_name && display_userinfo + echo ${red}Invalid Input${reset} + echo Enter x to go back fi done } -- 2.47.2 From 49aabd5af9d8791cd04ced70e03d9dbfe8ac1272 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 00:42:30 +0500 Subject: [PATCH 121/133] readme update with new file name --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 04c4af1..6524b3f 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ This project is currently under development and a lot of things are broken. ``` git clone https://github.com/shihaamabr/bml-cli cd bml-cli -chmod +x bml.sh -./bml.sh +chmod +x bml-cli.sh +./bml-cli.sh ``` #### Installation - Systemwide (NOT Recommended, May not work on some distros) ``` -- 2.47.2 From 297efc2402b6a1b56f012a521b1ecc4e58ec817d Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 01:24:44 +0500 Subject: [PATCH 122/133] call me regex king --- bml-cli.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 70c9673..178779f 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -470,8 +470,8 @@ api_activites(){ ################################################################################################ activities(){ echo Current Page: 1 - echo $API_ACTIVITES | jq -r '["Type","Date","Contact","Amount","Remarks","Status"], ["=====","=========","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + echo $API_ACTIVITES | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" | sed "s/[0-9]T[0-9]/ /g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K while true; do echo "" echo Total Pages: $PAGETOTAL @@ -482,13 +482,13 @@ activities(){ display_banner && display_name && display_userinfo echo Current Page: $PAGENO curl -s -b $COOKIE $BML_URL/activities?page=$PAGENO \ - | jq -r '["Type","Date","Contact","Amount","Remarks","Status"], ["=====","=========","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" | sed "s/[0-9]T[0-9]/ /g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K elif [ "$PAGENO" -gt "$PAGETOTAL" ] then display_banner && display_name && display_userinfo echo ${red}value too high${reset} - elif [ "$PAGENO" = "x" ] + elif [ "$PAGENO" = "x" ] || [ "$PAGENO" = "0" ] || [ "$PAGENO" = "back" ] then display_banner && display_name && display_userinfo main_menu -- 2.47.2 From 228edf4461f4b9ab3f62ac23aac025234860f11f Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 03:13:19 +0500 Subject: [PATCH 123/133] call me regex king not - it broke sup --- bml-cli.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bml-cli.sh b/bml-cli.sh index 178779f..1e1d615 100755 --- a/bml-cli.sh +++ b/bml-cli.sh @@ -471,7 +471,7 @@ api_activites(){ activities(){ echo Current Page: 1 echo $API_ACTIVITES | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | sed "s/[0-9]T[0-9]/ /g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K while true; do echo "" echo Total Pages: $PAGETOTAL @@ -483,7 +483,7 @@ activities(){ echo Current Page: $PAGENO curl -s -b $COOKIE $BML_URL/activities?page=$PAGENO \ | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | sed "s/[0-9]T[0-9]/ /g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K elif [ "$PAGENO" -gt "$PAGETOTAL" ] then display_banner && display_name && display_userinfo -- 2.47.2 From 79e6f9a4c18abbf8b92ad7ab09b4e1cb1f88ec76 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 03:48:24 +0500 Subject: [PATCH 124/133] packing --- README.md | 4 +- bml-cli | 766 +++++++++++++++++++++++++++++++++++++++++++++++++++ installer.sh | 2 +- 3 files changed, 769 insertions(+), 3 deletions(-) create mode 100755 bml-cli diff --git a/README.md b/README.md index 6524b3f..563a1e6 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ This project is currently under development and a lot of things are broken. ``` git clone https://github.com/shihaamabr/bml-cli cd bml-cli -chmod +x bml-cli.sh -./bml-cli.sh +chmod +x bml-cli +./bml-cli ``` #### Installation - Systemwide (NOT Recommended, May not work on some distros) ``` diff --git a/bml-cli b/bml-cli new file mode 100755 index 0000000..1e1d615 --- /dev/null +++ b/bml-cli @@ -0,0 +1,766 @@ +#!/bin/bash + +cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 +CONFIG=~/.config/bml-cli/config +CREDENTIALS=~/.config/bml-cli/.credentials +COOKIE=~/.cache/bml-cli/.cookie +BML_RESETPASS='https://www.bankofmaldives.com.mv/internetbanking/forgot_password' + +#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` +# Colors +G='\e[01;32m' # GREEN TEXT +R='\e[01;31m' # RED TEXT +Y='\e[01;33m' # YELLOW TEXT +B='\e[01;34m' # BLUE TEXT +V='\e[01;35m' # VIOLET TEXT +Bl='\e[01;30m' # BLACK TEXT +C='\e[01;36m' # CYAN TEXT +W='\e[01;37m' # WHITE TEXT +BGBL='\e[1;30;47m' # Background W Text Bl +N='\e[0m' # How to use (example): echo "${G}example${N}" +loadBar=' ' # Load UI + +##Setting Up Functions +animate(){ + PID=$! + h=0 + anim='⠋⠙⠴⠦' + while [ -d /proc/$PID ]; do + h=$(((h + 1) % 4)) + sleep 0.05 + printf "\r${@} [${anim:$h:1}]" + done +} +initialize(){ + echo initalizing.. + mkdir -p ~/.config/bml-cli/ + mkdir -p ~/.cache/bml-cli/ + echo "# DO NOT EDIT THIS MANUALLY!!" > $CREDENTIALS + echo "BML_USERNAME='' # Your encrypted BML Username" >> $CREDENTIALS + echo "BML_PASSWORD='' # Your encrypted BML Password" >> $CREDENTIALS + echo "# DO NOT EDIT THIS UNLESS NECESSARY!!" > $CONFIG + echo "I_AM_HYPOCRITE='false' # This is for MacOS Users ONLY" >> $CONFIG + echo "I_AM_SODU='false' # This is for WSL Users ONLY" >> $CONFIG + echo "" >> $CONFIG + echo "BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' # BML API URL " >> $CONFIG +} + +check_connection(){ + PING=$(ping -c 1 www.bankofmaldives.com.mv 2> /dev/null | grep -oE 0%) + if [ "$PING" != "0%" ] + then + echo ${red}Check your connection and try again.${reset} + exit 1 + fi + DOS=$(curl -s https://www.bankofmaldives.com.mv/ | grep -oE "error code: 1020") + if [ "$DOS" = "error code: 1020" ] + then + echo ${red}Access denied${reset} + echo Try again later + exit + fi +} + +os_detect(){ + 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 + if [ "$I_AM_SODU" != "true" ] + then + echo ${red}Please check $CONFIG and configure accordingly.${reset} + cexit + fi + elif [ "$MAC" = "Darwin" ] + then + OS=macos + export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" + if [ "$I_AM_HYPOCRITE" != "true" ] + then + echo ${red}Please check $CONFIG and configure accordingly.${reset} + cexit + fi + elif [ "$ANDROID" = "Android" ] + then + OS=android + fi + banner +} +################################################################## +display_banner(){ + clear + echo "${red}" + echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" + echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" + echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" + echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" + echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" + echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" + echo "${reset}" +} +display_welcome(){ + echo ${green}Welcome ${reset}$NAME + echo "" +} +display_name(){ + echo "" + echo ${cyan}Name${reset}: $NAME +} +display_userinfo(){ + echo ${cyan}Phone${reset}: $PHONE + echo ${cyan}Email${reset}: $EMAIL + echo ${cyan}Birthday${reset}: $DOB + echo ${cyan}ID Card${reset}: $IDCARD + echo "" +} +#################################################################### +cexit(){ + echo "Cleaning up.." + rm $COOKIE 2> /dev/null + sleep 0.2 + exit +} + +reset_config(){ + read -p 'Are you sure: [y/N]' SURE + if [ "$SURE" = "y" ] || [ "$SURE" = "Y" ] + then + display_banner + sleep 0.5 + echo Deleting Configration.... & rm -rf ~/.config/bml-cli + sleep 0.5 + echo Deleting Credentials.... & rm -rf ~/.cache/bml-cli + cexit + else + display_banner && display_name && display_userinfo + settings + fi +} +readpin(){ + read -s -p 'Enter Pin: ' PIN + echo "" + CHECK_PIN=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2 2>&1 | grep -oE bad) + if [ "$CHECK_PIN" = "bad bad" ] + then + echo ${R}Incorrect Pin${N} + readpin + fi + #banner + BML_USERNAME_UNSAFE=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) + BML_PASSWORD_UNSAFE=$(echo ${BML_PASSWORD} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) + #banner + login #& animate "Logging in" +} + +wipe_credentials(){ + sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='' # Your encrypted BML Username @" $CREDENTIALS + sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='' # Your encrypted BML Password @" $CREDENTIALS +} +urandom(){ + BML_USERNAME_UNSAFE=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) + BML_PASSWORD_UNSAFE=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) + 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) + REPEAT_PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) + NEW_PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) +} +savepass(){ + if [ "$BML_USERNAME" = "" ] && [ "$BML_PASSWORD" = "" ] + 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 New Pin: ' NEW_PIN + echo "" + read -s -p 'Repeat Pin: ' REPEAT_PIN + if [ "$NEW_PIN" = "$REPEAT_PIN" ] + then + echo "" + BML_USERNAME=$(echo "${BML_USERNAME_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) + BML_PASSWORD=$(echo "${BML_PASSWORD_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) + #encrypt_user #& initanimate "Encrypting Username" + #encrypt_pass #& initanimate "Encrypting Password" + echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" + sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='${BML_USERNAME}' # Your encrypted BML Username @" $CREDENTIALS + sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='${BML_PASSWORD}' # Your encrypted BML Password @" $CREDENTIALS + else + echo "" + echo ${R}Pin do not match${N} + savepass + fi + else + echo Password not saved. + fi + else + : + fi + urandom + select_profile #& animate "Selecting Profile" # urandom && select_profile +} +################################################################################################ + +################################################################################################ +login(){ + LOGIN=$(curl -s -c $COOKIE $BML_URL/login \ + --data-raw username=$BML_USERNAME_UNSAFE \ + --data-raw password=${BML_PASSWORD_UNSAFE} \ + | jq -r .code) + if [ "$LOGIN" = "0" ] + then + display_banner + echo ${lightgreen}Login success${reset} + savepass + elif [ "$LOGIN" = "20" ] + then + display_banner + account_locked + sleep 1.5 + display_banner + echo "${red}Account Locked!${reset}" + echo "${lightred}Please reset password and login again.${reset}" + enter_credentials + elif [ "$LOGIN" = "2" ] + then + display_banner + echo ${red}Password or Username Incorrect${reset} + wipe_credentials + enter_credentials + 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 +} +################################################################################################ + +################################################################################################ +account_locked(){ + 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 +} +################################################################################################ + +################################################################################################ +enter_credentials(){ + #echo "" + read -p 'Username: ' BML_USERNAME_UNSAFE + read -s -p 'Password: ' BML_PASSWORD_UNSAFE + echo "" + login +} +################################################################################################ + +################################################################################################ +select_profile(){ +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(){ + USERINFO=$(curl -s -b $COOKIE $BML_URL/userinfo) + SUCCESS=$(echo $USERINFO | jq -r .success) + if [ "$SUCCESS" != "true" ] + then + echo ${red}Login Required${reset} + init_login + display_banner + userinfo + fi + USERINFO=$(echo $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) +} +################################################################################################ + +################################################################################################ +accounts(){ + echo $DASHBOARD \ + | jq -r '["Account Name"," Account Number","Type", "Currency", "Balance"], ["===================","==============","==================","=========","========="], (.payload | .dashboard |.[] | [.alias, .account, .product, .currency, .availableBalance]) | @tsv' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K +} +################################################################################################ +api_dashboard(){ + DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard) + SUCCESS=$(echo $DASHBOARD | jq -r .success) + if [ "$SUCCESS" != "true" ] + then + echo ${red}Login Required${reset} + init_login + display_banner && display_name && display_userinfo + api_dashboard + fi +} + +################################################################################################ +list_contacts(){ + echo $API_CONATACTS | jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["​​===========","==============","========","=============================","============================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K +} +################################################################################################ +api_contacts(){ + API_CONATACTS=$(curl -s -b $COOKIE $BML_URL/contacts) + SUCCESS=$(echo $API_CONATACTS | jq -r .code) + if [ "$SUCCESS" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner && display_name && display_userinfo + api_contacts + fi +} + +################################################################################################ +transfer(){ +# banner + accounts + echo "" + echo "Select debit account" + echo "Enter credit account" +} +################################################################################################ + +################################################################################################ +api_account(){ + API_ACCOUNT=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER) + SUCCESS=$(echo $API_ACCOUNT | jq -r .code) + if [ "$SUCCESS" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner && display_name && display_userinfo + fi +} +################################################################################################ + +################################################################################################ +add_contact(){ + printf 'Account Number: ' + read -r ACCOUNT_NUMBER + + if [ "$ACCOUNT_NUMBER" = "x" ] || [ "$ACCOUNT_NUMBER" = "back" ] + then + display_banner && display_name && display_userinfo + contacts_menu + elif [ "$ACCOUNT_NUMBER" = "" ] + then + display_banner && display_name && display_userinfo + echo ${red}No input${reset} + echo Input account number or ${lightgreen}x${reset} to go back + add_contact + fi + +api_account +VALID_NUMBER=$(echo $API_ACCOUNT | jq -r .success) + +if [ "$VALID_NUMBER" = "true" ] +then + + ACCOUNT_NAME=$(echo $API_ACCOUNT | jq -r '.["payload"] | .name') + CURRENCY=$(echo $API_ACCOUNT | 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 + fi + CONTACT_NAME_SED=`echo "$CONTACT_NAME" | sed "s/ /%20/g"` + ADDCONTACT=$(curl -s -b $COOKIE $BML_URL/contacts \ + --data-raw contact_type=IAT \ + --data-raw account=$ACCOUNT_NUMBER \ + --data-raw alias=$CONTACT_NAME_SED \ + --compressed \ + | jq -r .code) + + if [ "$ADDCONTACT" = "0" ] + then + display_banner && display_name && display_userinfo + echo $ACCOUNT_NUMBER ${lightgreen}saved as ${reset} $CONTACT_NAME ${lightgreen}succesfully${reset} + elif [ "$ADDCONTACT" = "17" ] + then + echo ${red}Login Required ${reset} + init_login + add_contact + else + display_banner && display_name && display_userinfo + echo "${red}There was an error${reset}" + fi +else + echo "${red}Invalid Account${reset}" 1>&2 + add_contact +fi +} +################################################################################################ + +################################################################################################ +delete_contact(){ + 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 + contacts_menu + else + echo "${red}There was an error${reset}" + delete_contact + fi +} +################################# +api_activites(){ + API_ACTIVITES=$(curl -s -b $COOKIE $BML_URL/activities) + SUCCESS=$(echo $API_ACTIVITES | jq -r .code) + if [ "$SUCCESS" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner && display_name && display_userinfo + api_activites + fi + PAGETOTAL=$(echo $API_ACTIVITES | jq -r '.payload | .content | .last_page') + +} +################################################################################################ +activities(){ + echo Current Page: 1 + echo $API_ACTIVITES | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + while true; do + echo "" + echo Total Pages: $PAGETOTAL + read -p "Enter Page Number: " PAGENO + + if [ "$PAGENO" -le "$PAGETOTAL" ] + then + display_banner && display_name && display_userinfo + echo Current Page: $PAGENO + curl -s -b $COOKIE $BML_URL/activities?page=$PAGENO \ + | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + elif [ "$PAGENO" -gt "$PAGETOTAL" ] + then + display_banner && display_name && display_userinfo + echo ${red}value too high${reset} + elif [ "$PAGENO" = "x" ] || [ "$PAGENO" = "0" ] || [ "$PAGENO" = "back" ] + then + display_banner && display_name && display_userinfo + main_menu + else + display_banner && display_name && display_userinfo + echo ${red}Invalid Input${reset} + echo Enter x to go back + fi + done +} +services(){ + echo "" + echo "Work In Progress" + read -p "Press enter to return to main menu" BRUH + display_banner && display_name && display_userinfo + main_menu +} +################################################################################################ +main_menu(){ +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 + api_dashboard # & animate "Fetching account details" + display_banner && display_name && display_userinfo + accounts + accounts_menu + elif [ "$MENU" = "2" ] + then + display_banner && display_name && display_userinfo + transfer_menu + elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ] + then + display_banner && display_name && display_userinfo + api_contacts #& animate "Fetching contacts" + list_contacts + contacts_menu + elif [ "$MENU" = "4" ] + then + display_banner && display_name && display_userinfo + api_activites + activities + elif [ "$MENU" = "5" ] + then + display_banner && display_name && display_userinfo + services + elif [ "$MENU" = "6" ] + then + display_banner && display_name && display_userinfo + settings + elif [ "$MENU" = "exit" ] || [ "$MENU" = "x" ] + then + cexit + else + display_banner && display_name && display_userinfo + echo ${red}Invalid input:${yellow} $MENU ${reset} 1>&2 + main_menu +fi +} +############################################################################################## +accounts_menu(){ + echo "" + echo "Work In Progress" + read -p "Press enter to return main menu" BRUH + display_banner && display_name && display_userinfo + main_menu +} +################################################################################################ +contacts_menu(){ + echo "Contacts" + echo "" + echo "1 - Transfer" + echo "2 - Add New Contact" + echo "3 - Delete Contact" + echo "x - Go back" + echo "" + printf 'Please Input: ' +read -r CONTACTS + +if [ "$CONTACTS" = "1" ] || ["$CONTACTS" = "transfer" ] +then + display_banner && display_name && display_userinfo + transfer_menu +elif [ "$CONTACTS" = "2" ] || ["$CONTACTS" = "add new contact" ] +then + display_banner && display_name && display_userinfo + add_contact + contacts_menu +elif [ "$CONTACTS" = "3" ] || ["$CONTACTS" = "delete contact" ] +then + display_banner && display_name && display_userinfo + list_contacts + delete_contact + api_contacts + contact_menu +elif [ "$CONTACTS" = "x" ] || [ "$CONTACTS" = "back" ] +then + display_banner && display_name && display_userinfo + main_menu +elif [ "$CONTACTS" = "exit" ] +then + cexit +else + display_banner && display_name && display_userinfo + echo ${red}Invalid input:${yellow} $CONTACTS ${reset} 1>&2 + contacts_menu +fi +} +transfer_menu(){ + echo "Work In Progress" + read -p "Press enter to return to main menu" BRUH + display_banner && display_name && display_userinfo + main_menu +} +########################################################################################### +change_password(){ + 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 + ECHOOTPCHANNEL=$PHONE + break + elif [ "$OTPCHANNEL" = "2" ] || [ "$OTPCHANNEL" = "email" ] + then + OTPCHANNEL=email + ECHOOTPCHANNEL=$EMAIL + break + elif [ "$OTPCHANNEL" = "back" ] || [ "$OTPCHANNEL" = "x" ] + then + display_banner && display_name && display_userinfo + settings + else + display_banner && display_name && display_userinfo + echo ${red}Invalid Input${reset} + echo Enter x to back + fi + done + + read -s -p 'Enter Current Password: ' OLD_PASSWORD + + 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 + display_banner && display_name && display_userinfo + echo "${red}Password do not match${reset}" + echo "Try again" + else + break + fi + done + + + 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 > /dev/null + + echo ${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset} + read -p 'Enter OTP: ' OTP + CHANGEPASSWORD=$(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 \ + | jq -r .code) + + if [ "$CHANGEPASSWORD" = "0" ] + then + echo Password changed succesfully ${reset} + elif [ "$CHANGEPASSWORD" = "8" ] + then + display_banner && display_name && display_userinfo + echo ${red}Old Password is incorrect${reset} + echo failed to change password + change_password + elif [ "$CHANGEPASSWORD" = "24" ] + then + display_banner && display_name && display_userinfo + echo ${red}Invalid OTP${reset} + echo failed to change password + change_password + elif [ "$CHANGEPASSWORD" = "17" ] + then + echo ${red}Login Required${reset} + init_login + display_banner + change_password + else + echo unknown error + main_menu + fi + + +} +############################################################################################## + + +################################################################################################ +settings(){ + echo "Settings" + echo "1 - Logout" + echo "2 - Logout and reset config" + echo "3 - Change Password" + echo "" + printf 'Please Input: ' + read -r SETTINGS + + if [ "$SETTINGS" = "1" ] + then + display_banner + wipe_credentials + cexit + elif [ "$SETTINGS" = "2" ] + then + display_banner + reset_config + elif [ "$SETTINGS" = "3" ] + then + display_banner && display_name && display_userinfo + change_password + elif [ "$SETTINGS" = "x" ] || [ "$SETTINGS" = "back" ] + then + display_banner && display_name && display_userinfo + main_menu + else + display_banner && display_name && display_userinfo + echo ${red}Invalid input:${yellow} $SETTINGS ${reset} 1>&2 + settings + fi +} + + +if [ ! -f $CONFIG ] +then + initialize +fi + +init_login(){ + if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] + then + readpin + else + enter_credentials + fi +} +display_banner && check_connection #& animate "Checking Internet Connection" +source $CONFIG +source $CREDENTIALS +display_banner && os_detect # & animate "Detecting Operating System" +display_banner && init_login +userinfo +display_banner && display_welcome && display_userinfo && main_menu diff --git a/installer.sh b/installer.sh index 7e1282d..e3fb70b 100644 --- a/installer.sh +++ b/installer.sh @@ -4,7 +4,7 @@ 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-cli.sh" >> /usr/bin/bml-cli +echo "source /opt/sar/bml-cli/bml-cli" >> /usr/bin/bml-cli chmod 755 /usr/bin/bml-cli rm -rf bml-cli/ echo "Installation Complete" -- 2.47.2 From 314e532414a45ddd2d43a6abdd7685e5d21d9e52 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 03:49:19 +0500 Subject: [PATCH 125/133] packing --- bml-cli.sh | 766 ----------------------------------------------------- 1 file changed, 766 deletions(-) delete mode 100755 bml-cli.sh diff --git a/bml-cli.sh b/bml-cli.sh deleted file mode 100755 index 1e1d615..0000000 --- a/bml-cli.sh +++ /dev/null @@ -1,766 +0,0 @@ -#!/bin/bash - -cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 -CONFIG=~/.config/bml-cli/config -CREDENTIALS=~/.config/bml-cli/.credentials -COOKIE=~/.cache/bml-cli/.cookie -BML_RESETPASS='https://www.bankofmaldives.com.mv/internetbanking/forgot_password' - -#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` -# Colors -G='\e[01;32m' # GREEN TEXT -R='\e[01;31m' # RED TEXT -Y='\e[01;33m' # YELLOW TEXT -B='\e[01;34m' # BLUE TEXT -V='\e[01;35m' # VIOLET TEXT -Bl='\e[01;30m' # BLACK TEXT -C='\e[01;36m' # CYAN TEXT -W='\e[01;37m' # WHITE TEXT -BGBL='\e[1;30;47m' # Background W Text Bl -N='\e[0m' # How to use (example): echo "${G}example${N}" -loadBar=' ' # Load UI - -##Setting Up Functions -animate(){ - PID=$! - h=0 - anim='⠋⠙⠴⠦' - while [ -d /proc/$PID ]; do - h=$(((h + 1) % 4)) - sleep 0.05 - printf "\r${@} [${anim:$h:1}]" - done -} -initialize(){ - echo initalizing.. - mkdir -p ~/.config/bml-cli/ - mkdir -p ~/.cache/bml-cli/ - echo "# DO NOT EDIT THIS MANUALLY!!" > $CREDENTIALS - echo "BML_USERNAME='' # Your encrypted BML Username" >> $CREDENTIALS - echo "BML_PASSWORD='' # Your encrypted BML Password" >> $CREDENTIALS - echo "# DO NOT EDIT THIS UNLESS NECESSARY!!" > $CONFIG - echo "I_AM_HYPOCRITE='false' # This is for MacOS Users ONLY" >> $CONFIG - echo "I_AM_SODU='false' # This is for WSL Users ONLY" >> $CONFIG - echo "" >> $CONFIG - echo "BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' # BML API URL " >> $CONFIG -} - -check_connection(){ - PING=$(ping -c 1 www.bankofmaldives.com.mv 2> /dev/null | grep -oE 0%) - if [ "$PING" != "0%" ] - then - echo ${red}Check your connection and try again.${reset} - exit 1 - fi - DOS=$(curl -s https://www.bankofmaldives.com.mv/ | grep -oE "error code: 1020") - if [ "$DOS" = "error code: 1020" ] - then - echo ${red}Access denied${reset} - echo Try again later - exit - fi -} - -os_detect(){ - 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 - if [ "$I_AM_SODU" != "true" ] - then - echo ${red}Please check $CONFIG and configure accordingly.${reset} - cexit - fi - elif [ "$MAC" = "Darwin" ] - then - OS=macos - export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" - if [ "$I_AM_HYPOCRITE" != "true" ] - then - echo ${red}Please check $CONFIG and configure accordingly.${reset} - cexit - fi - elif [ "$ANDROID" = "Android" ] - then - OS=android - fi - banner -} -################################################################## -display_banner(){ - clear - echo "${red}" - echo "██████╗░███╗░░░███╗██╗░░░░░  ░█████╗░██╗░░░░░██╗" - echo "██╔══██╗████╗░████║██║░░░░░  ██╔══██╗██║░░░░░██║" - echo "██████╦╝██╔████╔██║██║░░░░░  ██║░░╚═╝██║░░░░░██║" - echo "██╔══██╗██║╚██╔╝██║██║░░░░░  ██║░░██╗██║░░░░░██║" - echo "██████╦╝██║░╚═╝░██║███████╗  ╚█████╔╝███████╗██║" - echo "╚═════╝░╚═╝░░░░░╚═╝╚══════╝  ░╚════╝░╚══════╝╚═╝" - echo "${reset}" -} -display_welcome(){ - echo ${green}Welcome ${reset}$NAME - echo "" -} -display_name(){ - echo "" - echo ${cyan}Name${reset}: $NAME -} -display_userinfo(){ - echo ${cyan}Phone${reset}: $PHONE - echo ${cyan}Email${reset}: $EMAIL - echo ${cyan}Birthday${reset}: $DOB - echo ${cyan}ID Card${reset}: $IDCARD - echo "" -} -#################################################################### -cexit(){ - echo "Cleaning up.." - rm $COOKIE 2> /dev/null - sleep 0.2 - exit -} - -reset_config(){ - read -p 'Are you sure: [y/N]' SURE - if [ "$SURE" = "y" ] || [ "$SURE" = "Y" ] - then - display_banner - sleep 0.5 - echo Deleting Configration.... & rm -rf ~/.config/bml-cli - sleep 0.5 - echo Deleting Credentials.... & rm -rf ~/.cache/bml-cli - cexit - else - display_banner && display_name && display_userinfo - settings - fi -} -readpin(){ - read -s -p 'Enter Pin: ' PIN - echo "" - CHECK_PIN=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2 2>&1 | grep -oE bad) - if [ "$CHECK_PIN" = "bad bad" ] - then - echo ${R}Incorrect Pin${N} - readpin - fi - #banner - BML_USERNAME_UNSAFE=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) - BML_PASSWORD_UNSAFE=$(echo ${BML_PASSWORD} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2) - #banner - login #& animate "Logging in" -} - -wipe_credentials(){ - sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='' # Your encrypted BML Username @" $CREDENTIALS - sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='' # Your encrypted BML Password @" $CREDENTIALS -} -urandom(){ - BML_USERNAME_UNSAFE=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) - BML_PASSWORD_UNSAFE=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) - 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) - REPEAT_PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) - NEW_PIN=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5) -} -savepass(){ - if [ "$BML_USERNAME" = "" ] && [ "$BML_PASSWORD" = "" ] - 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 New Pin: ' NEW_PIN - echo "" - read -s -p 'Repeat Pin: ' REPEAT_PIN - if [ "$NEW_PIN" = "$REPEAT_PIN" ] - then - echo "" - BML_USERNAME=$(echo "${BML_USERNAME_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) - BML_PASSWORD=$(echo "${BML_PASSWORD_UNSAFE}" | openssl enc -e -des3 -base64 -pass pass:${NEW_PIN} -pbkdf2) - #encrypt_user #& initanimate "Encrypting Username" - #encrypt_pass #& initanimate "Encrypting Password" - echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS" - sed -i "s@BML_USERNAME=.*\$@BML_USERNAME='${BML_USERNAME}' # Your encrypted BML Username @" $CREDENTIALS - sed -i "s@BML_PASSWORD=.*\$@BML_PASSWORD='${BML_PASSWORD}' # Your encrypted BML Password @" $CREDENTIALS - else - echo "" - echo ${R}Pin do not match${N} - savepass - fi - else - echo Password not saved. - fi - else - : - fi - urandom - select_profile #& animate "Selecting Profile" # urandom && select_profile -} -################################################################################################ - -################################################################################################ -login(){ - LOGIN=$(curl -s -c $COOKIE $BML_URL/login \ - --data-raw username=$BML_USERNAME_UNSAFE \ - --data-raw password=${BML_PASSWORD_UNSAFE} \ - | jq -r .code) - if [ "$LOGIN" = "0" ] - then - display_banner - echo ${lightgreen}Login success${reset} - savepass - elif [ "$LOGIN" = "20" ] - then - display_banner - account_locked - sleep 1.5 - display_banner - echo "${red}Account Locked!${reset}" - echo "${lightred}Please reset password and login again.${reset}" - enter_credentials - elif [ "$LOGIN" = "2" ] - then - display_banner - echo ${red}Password or Username Incorrect${reset} - wipe_credentials - enter_credentials - 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 -} -################################################################################################ - -################################################################################################ -account_locked(){ - 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 -} -################################################################################################ - -################################################################################################ -enter_credentials(){ - #echo "" - read -p 'Username: ' BML_USERNAME_UNSAFE - read -s -p 'Password: ' BML_PASSWORD_UNSAFE - echo "" - login -} -################################################################################################ - -################################################################################################ -select_profile(){ -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(){ - USERINFO=$(curl -s -b $COOKIE $BML_URL/userinfo) - SUCCESS=$(echo $USERINFO | jq -r .success) - if [ "$SUCCESS" != "true" ] - then - echo ${red}Login Required${reset} - init_login - display_banner - userinfo - fi - USERINFO=$(echo $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) -} -################################################################################################ - -################################################################################################ -accounts(){ - echo $DASHBOARD \ - | jq -r '["Account Name"," Account Number","Type", "Currency", "Balance"], ["===================","==============","==================","=========","========="], (.payload | .dashboard |.[] | [.alias, .account, .product, .currency, .availableBalance]) | @tsv' \ - | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K -} -################################################################################################ -api_dashboard(){ - DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard) - SUCCESS=$(echo $DASHBOARD | jq -r .success) - if [ "$SUCCESS" != "true" ] - then - echo ${red}Login Required${reset} - init_login - display_banner && display_name && display_userinfo - api_dashboard - fi -} - -################################################################################################ -list_contacts(){ - echo $API_CONATACTS | jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["​​===========","==============","========","=============================","============================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' \ - | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K -} -################################################################################################ -api_contacts(){ - API_CONATACTS=$(curl -s -b $COOKIE $BML_URL/contacts) - SUCCESS=$(echo $API_CONATACTS | jq -r .code) - if [ "$SUCCESS" = "17" ] - then - echo ${red}Login Required${reset} - init_login - display_banner && display_name && display_userinfo - api_contacts - fi -} - -################################################################################################ -transfer(){ -# banner - accounts - echo "" - echo "Select debit account" - echo "Enter credit account" -} -################################################################################################ - -################################################################################################ -api_account(){ - API_ACCOUNT=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER) - SUCCESS=$(echo $API_ACCOUNT | jq -r .code) - if [ "$SUCCESS" = "17" ] - then - echo ${red}Login Required${reset} - init_login - display_banner && display_name && display_userinfo - fi -} -################################################################################################ - -################################################################################################ -add_contact(){ - printf 'Account Number: ' - read -r ACCOUNT_NUMBER - - if [ "$ACCOUNT_NUMBER" = "x" ] || [ "$ACCOUNT_NUMBER" = "back" ] - then - display_banner && display_name && display_userinfo - contacts_menu - elif [ "$ACCOUNT_NUMBER" = "" ] - then - display_banner && display_name && display_userinfo - echo ${red}No input${reset} - echo Input account number or ${lightgreen}x${reset} to go back - add_contact - fi - -api_account -VALID_NUMBER=$(echo $API_ACCOUNT | jq -r .success) - -if [ "$VALID_NUMBER" = "true" ] -then - - ACCOUNT_NAME=$(echo $API_ACCOUNT | jq -r '.["payload"] | .name') - CURRENCY=$(echo $API_ACCOUNT | 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 - fi - CONTACT_NAME_SED=`echo "$CONTACT_NAME" | sed "s/ /%20/g"` - ADDCONTACT=$(curl -s -b $COOKIE $BML_URL/contacts \ - --data-raw contact_type=IAT \ - --data-raw account=$ACCOUNT_NUMBER \ - --data-raw alias=$CONTACT_NAME_SED \ - --compressed \ - | jq -r .code) - - if [ "$ADDCONTACT" = "0" ] - then - display_banner && display_name && display_userinfo - echo $ACCOUNT_NUMBER ${lightgreen}saved as ${reset} $CONTACT_NAME ${lightgreen}succesfully${reset} - elif [ "$ADDCONTACT" = "17" ] - then - echo ${red}Login Required ${reset} - init_login - add_contact - else - display_banner && display_name && display_userinfo - echo "${red}There was an error${reset}" - fi -else - echo "${red}Invalid Account${reset}" 1>&2 - add_contact -fi -} -################################################################################################ - -################################################################################################ -delete_contact(){ - 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 - contacts_menu - else - echo "${red}There was an error${reset}" - delete_contact - fi -} -################################# -api_activites(){ - API_ACTIVITES=$(curl -s -b $COOKIE $BML_URL/activities) - SUCCESS=$(echo $API_ACTIVITES | jq -r .code) - if [ "$SUCCESS" = "17" ] - then - echo ${red}Login Required${reset} - init_login - display_banner && display_name && display_userinfo - api_activites - fi - PAGETOTAL=$(echo $API_ACTIVITES | jq -r '.payload | .content | .last_page') - -} -################################################################################################ -activities(){ - echo Current Page: 1 - echo $API_ACTIVITES | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K - while true; do - echo "" - echo Total Pages: $PAGETOTAL - read -p "Enter Page Number: " PAGENO - - if [ "$PAGENO" -le "$PAGETOTAL" ] - then - display_banner && display_name && display_userinfo - echo Current Page: $PAGENO - curl -s -b $COOKIE $BML_URL/activities?page=$PAGENO \ - | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K - elif [ "$PAGENO" -gt "$PAGETOTAL" ] - then - display_banner && display_name && display_userinfo - echo ${red}value too high${reset} - elif [ "$PAGENO" = "x" ] || [ "$PAGENO" = "0" ] || [ "$PAGENO" = "back" ] - then - display_banner && display_name && display_userinfo - main_menu - else - display_banner && display_name && display_userinfo - echo ${red}Invalid Input${reset} - echo Enter x to go back - fi - done -} -services(){ - echo "" - echo "Work In Progress" - read -p "Press enter to return to main menu" BRUH - display_banner && display_name && display_userinfo - main_menu -} -################################################################################################ -main_menu(){ -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 - api_dashboard # & animate "Fetching account details" - display_banner && display_name && display_userinfo - accounts - accounts_menu - elif [ "$MENU" = "2" ] - then - display_banner && display_name && display_userinfo - transfer_menu - elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ] - then - display_banner && display_name && display_userinfo - api_contacts #& animate "Fetching contacts" - list_contacts - contacts_menu - elif [ "$MENU" = "4" ] - then - display_banner && display_name && display_userinfo - api_activites - activities - elif [ "$MENU" = "5" ] - then - display_banner && display_name && display_userinfo - services - elif [ "$MENU" = "6" ] - then - display_banner && display_name && display_userinfo - settings - elif [ "$MENU" = "exit" ] || [ "$MENU" = "x" ] - then - cexit - else - display_banner && display_name && display_userinfo - echo ${red}Invalid input:${yellow} $MENU ${reset} 1>&2 - main_menu -fi -} -############################################################################################## -accounts_menu(){ - echo "" - echo "Work In Progress" - read -p "Press enter to return main menu" BRUH - display_banner && display_name && display_userinfo - main_menu -} -################################################################################################ -contacts_menu(){ - echo "Contacts" - echo "" - echo "1 - Transfer" - echo "2 - Add New Contact" - echo "3 - Delete Contact" - echo "x - Go back" - echo "" - printf 'Please Input: ' -read -r CONTACTS - -if [ "$CONTACTS" = "1" ] || ["$CONTACTS" = "transfer" ] -then - display_banner && display_name && display_userinfo - transfer_menu -elif [ "$CONTACTS" = "2" ] || ["$CONTACTS" = "add new contact" ] -then - display_banner && display_name && display_userinfo - add_contact - contacts_menu -elif [ "$CONTACTS" = "3" ] || ["$CONTACTS" = "delete contact" ] -then - display_banner && display_name && display_userinfo - list_contacts - delete_contact - api_contacts - contact_menu -elif [ "$CONTACTS" = "x" ] || [ "$CONTACTS" = "back" ] -then - display_banner && display_name && display_userinfo - main_menu -elif [ "$CONTACTS" = "exit" ] -then - cexit -else - display_banner && display_name && display_userinfo - echo ${red}Invalid input:${yellow} $CONTACTS ${reset} 1>&2 - contacts_menu -fi -} -transfer_menu(){ - echo "Work In Progress" - read -p "Press enter to return to main menu" BRUH - display_banner && display_name && display_userinfo - main_menu -} -########################################################################################### -change_password(){ - 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 - ECHOOTPCHANNEL=$PHONE - break - elif [ "$OTPCHANNEL" = "2" ] || [ "$OTPCHANNEL" = "email" ] - then - OTPCHANNEL=email - ECHOOTPCHANNEL=$EMAIL - break - elif [ "$OTPCHANNEL" = "back" ] || [ "$OTPCHANNEL" = "x" ] - then - display_banner && display_name && display_userinfo - settings - else - display_banner && display_name && display_userinfo - echo ${red}Invalid Input${reset} - echo Enter x to back - fi - done - - read -s -p 'Enter Current Password: ' OLD_PASSWORD - - 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 - display_banner && display_name && display_userinfo - echo "${red}Password do not match${reset}" - echo "Try again" - else - break - fi - done - - - 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 > /dev/null - - echo ${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset} - read -p 'Enter OTP: ' OTP - CHANGEPASSWORD=$(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 \ - | jq -r .code) - - if [ "$CHANGEPASSWORD" = "0" ] - then - echo Password changed succesfully ${reset} - elif [ "$CHANGEPASSWORD" = "8" ] - then - display_banner && display_name && display_userinfo - echo ${red}Old Password is incorrect${reset} - echo failed to change password - change_password - elif [ "$CHANGEPASSWORD" = "24" ] - then - display_banner && display_name && display_userinfo - echo ${red}Invalid OTP${reset} - echo failed to change password - change_password - elif [ "$CHANGEPASSWORD" = "17" ] - then - echo ${red}Login Required${reset} - init_login - display_banner - change_password - else - echo unknown error - main_menu - fi - - -} -############################################################################################## - - -################################################################################################ -settings(){ - echo "Settings" - echo "1 - Logout" - echo "2 - Logout and reset config" - echo "3 - Change Password" - echo "" - printf 'Please Input: ' - read -r SETTINGS - - if [ "$SETTINGS" = "1" ] - then - display_banner - wipe_credentials - cexit - elif [ "$SETTINGS" = "2" ] - then - display_banner - reset_config - elif [ "$SETTINGS" = "3" ] - then - display_banner && display_name && display_userinfo - change_password - elif [ "$SETTINGS" = "x" ] || [ "$SETTINGS" = "back" ] - then - display_banner && display_name && display_userinfo - main_menu - else - display_banner && display_name && display_userinfo - echo ${red}Invalid input:${yellow} $SETTINGS ${reset} 1>&2 - settings - fi -} - - -if [ ! -f $CONFIG ] -then - initialize -fi - -init_login(){ - if [ "$BML_USERNAME" != "" ] && [ "$BML_PASSWORD" != "" ] - then - readpin - else - enter_credentials - fi -} -display_banner && check_connection #& animate "Checking Internet Connection" -source $CONFIG -source $CREDENTIALS -display_banner && os_detect # & animate "Detecting Operating System" -display_banner && init_login -userinfo -display_banner && display_welcome && display_userinfo && main_menu -- 2.47.2 From 7574108e9756429bab3b710915a8eefeffa4901b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 04:54:12 +0500 Subject: [PATCH 126/133] they call me the regex king --- bml-cli | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bml-cli b/bml-cli index 1e1d615..765471c 100755 --- a/bml-cli +++ b/bml-cli @@ -470,8 +470,11 @@ api_activites(){ ################################################################################################ activities(){ echo Current Page: 1 - echo $API_ACTIVITES | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + echo $API_ACTIVITES \ + | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["====","==========","=========","==========================","==============","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" \ + | sed 's/\([0-9]\{4\}-[0-9][0-9]-[0-9][0-9]\)T\([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\)/\1 \2/g' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K while true; do echo "" echo Total Pages: $PAGETOTAL @@ -482,8 +485,10 @@ activities(){ display_banner && display_name && display_userinfo echo Current Page: $PAGENO curl -s -b $COOKIE $BML_URL/activities?page=$PAGENO \ - | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["====","==========","=========","==========================","============","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" \ + | sed 's/\([0-9]\{4\}-[0-9][0-9]-[0-9][0-9]\)T\([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\)/\1 \2/g' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K elif [ "$PAGENO" -gt "$PAGETOTAL" ] then display_banner && display_name && display_userinfo @@ -498,6 +503,7 @@ activities(){ echo Enter x to go back fi done + } services(){ echo "" -- 2.47.2 From d97634621e6f10ce68acf8fb67818c1bd4354d56 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 04:57:10 +0500 Subject: [PATCH 127/133] Delete 63 --- 63 | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 63 diff --git a/63 b/63 deleted file mode 100644 index e69de29..0000000 -- 2.47.2 From 30eaa42d78b12cf59ebe859f3ecf3fc16aa5ee40 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 25 May 2021 23:32:39 +0500 Subject: [PATCH 128/133] pin limited to 4 characters and auto enter --- bml-cli | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bml-cli b/bml-cli index 765471c..dbff77f 100755 --- a/bml-cli +++ b/bml-cli @@ -154,7 +154,7 @@ reset_config(){ fi } readpin(){ - read -s -p 'Enter Pin: ' PIN + read -n 4 -s -p 'Enter Pin: ' PIN echo "" CHECK_PIN=$(echo ${BML_USERNAME} | openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2 2>&1 | grep -oE bad) if [ "$CHECK_PIN" = "bad bad" ] @@ -187,9 +187,9 @@ savepass(){ read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN if [ "$SAVE_LOGIN" = "Y" ] || [ "$SAVE_LOGIN" = "y" ] then - read -s -p 'Enter New Pin: ' NEW_PIN + read -n 4 -s -p 'Enter New Pin: ' NEW_PIN echo "" - read -s -p 'Repeat Pin: ' REPEAT_PIN + read -n 4 -s -p 'Repeat Pin: ' REPEAT_PIN if [ "$NEW_PIN" = "$REPEAT_PIN" ] then echo "" @@ -766,7 +766,7 @@ init_login(){ display_banner && check_connection #& animate "Checking Internet Connection" source $CONFIG source $CREDENTIALS -display_banner && os_detect # & animate "Detecting Operating System" +display_banner && os_detect #& animate "Detecting Operating System" display_banner && init_login userinfo display_banner && display_welcome && display_userinfo && main_menu -- 2.47.2 From eb11dc472204cc226fd8e07ef5615ed2d73674bf Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 25 May 2021 23:34:47 +0500 Subject: [PATCH 129/133] press anykey to continue --- bml-cli | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bml-cli b/bml-cli index dbff77f..e0d58cc 100755 --- a/bml-cli +++ b/bml-cli @@ -508,7 +508,7 @@ activities(){ services(){ echo "" echo "Work In Progress" - read -p "Press enter to return to main menu" BRUH + read -n 1 -s -r -p "Press any key to continue" display_banner && display_name && display_userinfo main_menu } @@ -568,7 +568,7 @@ fi accounts_menu(){ echo "" echo "Work In Progress" - read -p "Press enter to return main menu" BRUH + read -n 1 -s -r -p "Press any key to continue" display_banner && display_name && display_userinfo main_menu } @@ -615,7 +615,7 @@ fi } transfer_menu(){ echo "Work In Progress" - read -p "Press enter to return to main menu" BRUH + read -n 1 -s -r -p "Press any key to continue" display_banner && display_name && display_userinfo main_menu } -- 2.47.2 From 9bee61cd10a3802e55430a5d9c5e17f79e287079 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 1 Jun 2021 09:37:41 +0500 Subject: [PATCH 130/133] installer dependecies check debian --- installer.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/installer.sh b/installer.sh index e3fb70b..bd465e6 100644 --- a/installer.sh +++ b/installer.sh @@ -1,4 +1,32 @@ #!/bin/bash +echo "Checking for curl..." +if command -v curl > /dev/null; then +echo "Detected curl..." +else +echo "Installing curl" +apt-get install -y gnupg + +echo "Checking for jq..." +if command -v jq > /dev/null; then +echo "Detected jq..." +else +echo "Installing jq" +apt-get install -y jq + +echo "Checking for openssl..." +if command -v openssl > /dev/null; then +echo "Detected openssl" +else +echo "Installing openssl" +apt-get install -y openssl + +echo "Checking for perl..." +if command -v perl > /dev/null; then +echo "Detected perl..." +else +echo "Installing perl" +apt-get install -y perl + cd /tmp/ git clone https://github.com/shihaamabr/bml-cli.git mkdir -p /opt/sar/bml-cli/ -- 2.47.2 From dc9c6b3e61bc444d4e38bb5e71c3b7aaccc80426 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 2 Jun 2021 22:48:42 +0500 Subject: [PATCH 131/133] quick fix for when adding existing contact --- bml-cli | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bml-cli b/bml-cli index e0d58cc..1e59872 100755 --- a/bml-cli +++ b/bml-cli @@ -424,6 +424,9 @@ then echo ${red}Login Required ${reset} init_login add_contact + elif [ "$ADDCONTACT" = "11" ] + then + echo You already have this contact saved as $CONATCT_NAME else display_banner && display_name && display_userinfo echo "${red}There was an error${reset}" -- 2.47.2 From 1040803752e46551bb857f06a420bb087c25d406 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 12 Jun 2021 00:35:18 +0500 Subject: [PATCH 132/133] no license --- LICENSE | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 5a97aa0..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Shiham Abdul Rahman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -- 2.47.2 From b23c354a9a26ec843d4013f2bb6ad5986390654c Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 12 Jun 2021 00:39:25 +0500 Subject: [PATCH 133/133] license --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..27d7354 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. -- 2.47.2