25 lines
619 B
Bash
Executable File
25 lines
619 B
Bash
Executable File
#!/bin/bash
|
|
#Import variables
|
|
source .env
|
|
|
|
get_balance(){
|
|
#Login
|
|
$curl -s -c $COOKIE $BML_URL/login \
|
|
--data-raw username=$BML_USERNAME \
|
|
--data-raw password=${BML_PASSWORD} > /dev/null
|
|
|
|
# Get profiles and select personal profile
|
|
PROFILE=$($curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1)
|
|
$curl -s -b $COOKIE $BML_URL/profile \
|
|
--data-raw profile=$PROFILE >> /dev/null
|
|
|
|
# Getting dashboard
|
|
BALANCE=$($curl -s -b $COOKIE $BML_URL/dashboard | jq -r '.payload | .dashboard |.[] | [.availableBalance] | .[]' | head -n1)
|
|
}
|
|
|
|
get_balance
|
|
|
|
# Print Balance
|
|
echo MVR: $BALANCE
|
|
|