spit it out bro

This commit is contained in:
Shihaam Abdul Rahman 2021-05-15 01:08:54 +05:00
parent fac54af225
commit db8f381eeb
2 changed files with 18 additions and 59 deletions

0
a.out Normal file
View File

View File

@ -8,80 +8,39 @@ fi
while true; do while true; do
LOGIN=$(curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} | jq -r .code) # attempt to login and generate cookie curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} # attempt to login and generate cookie
PROFILE=$(curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1) ; echo $PROFILE # get Personal Profile
if [ "$LOGIN" = "0" ] # if Login success curl -s -b $COOKIE $BML_URL/profile --data-raw profile=$PROFILE # select Personal Profile
then CHECKDIFF1=$(echo $HISTORY | wc -c) ; echo $CHECKDIFF1 # check intial and previous history
PROFILE=$(curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1) # get Personal Profile HISTORY=$(curl -s -b $COOKIE $BML_URL/account/$BML_ACCOUNTID/history/today | jq -r '.payload | .history | .[]') ; echo $HISTORY # request history
NONEED=$(curl -s -b $COOKIE $BML_URL/profile --data-raw profile=$PROFILE) # select Personal Profile CHECKDIFF2=$(echo $HISTORY | wc -c) ; echo $CHECKDIFF2 # check new history
elif [ "$LOGIN" = "2" ] DELAY=$(cat delay) ; echo $DELAY # read delay file and get value
then
echo 'Your username or password is incorrect.'
echo 'Please check .env to see if theyre entered correctly.'
echo 'exiting..'
exit
elif [ "$LOGIN" = "20" ]
then
echo 'Your account is locked!'
echo 'Reset password from "https://www.bankofmaldives.com.mv/internetbanking/forgot_password"'
echo 'exiting..'
exit
elif [ "$LOGIN" = "" ]
then
if [ "curl -s https://www.bankofmaldives.com.mv/" = "error code: 1020" ]
then
echo "Your IP is blocked from CF for DoS attack"
echo "Increase delay and try again later"
echo 'exiting..'
exit
else
echo 'Something went wrong..'
echo 'exiting..'
exit
fi
else
echo 'Something went wrong..'
echo 'exiting..'
exit
fi
CHECKDIFF1=$(echo $HISTORY | wc -c) # check intial and previous history
HISTORY=$(curl -s -b $COOKIE $BML_URL/account/$BML_ACCOUNTID/history/today | jq -r '.payload | .history | .[]') # request history
CHECKDIFF2=$(echo $HISTORY | wc -c) # check new history
DELAY=$(cat delay) # read delay file and get value
if [ "$CHECKDIFF1" != "$CHECKDIFF2" ] # if previous history do not match with new history if [ "$CHECKDIFF1" != "$CHECKDIFF2" ] # if previous history do not match with new history
then then
DESCRIPTION=$(echo $HISTORY | jq -r .description | head -n1) # get last trascation description DESCRIPTION=$(echo $HISTORY | jq -r .description | head -n1) ; echo $DESCRIPTION # get last trascation description
AMOUNT=$(echo $HISTORY | jq -r .amount | head -n1) # get last trascation amount AMOUNT=$(echo $HISTORY | jq -r .amount | head -n1) ; echo $AMOUNT # get last trascation amount
if [ "$DESCRIPTION" = "Transfer Credit" ] # if last trascation is description is Transfer Credit if [ "$DESCRIPTION" = "Transfer Credit" ] # if last trascation is description is Transfer Credit
then then
FROMTOAT=From FROMTOAT=From
ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) # get last persona or place name ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) ; echo $ENTITY # get last persona or place name
elif [ "$DESCRIPTION" = "Transfer Debit" ] # if last trascation descripton is Transfer Debit elif [ "$DESCRIPTION" = "Transfer Debit" ] # if last trascation descripton is Transfer Debit
then then
FROMTOAT=To FROMTOAT=To
ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) # get last person or place name ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) ; echo $ENTITY # get last person or place name
elif [ "$DESCRIPTION" = "ATM Withdrawal" ] # if last trascation descripton is ATM Withdrawal elif [ "$DESCRIPTION" = "ATM Withdrawal" ] || [ "$DESCRIPTION" = "Purchase" ] # if last trascation descripton is ATM Withdrawal
then then
FROMTOAT=At FROMTOAT=At
ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) #get last ATM name ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) ; echo $ENTITY #get last ATM name
elif [ "$DESCRIPTION" = "Purchase" ]
then
FROMTOAT=At
ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1)
elif [ "$DESCRIPTION" = "Salary" ] # if last trascation descripton is Salary elif [ "$DESCRIPTION" = "Salary" ] # if last trascation descripton is Salary
then then
FROMTOAT=From FROMTOAT=From
ENTITY=$(echo $HISTORY | jq -r .narrative2 | head -n1) # get last trascation company name ENTITY=$(echo $HISTORY | jq -r .narrative2 | head -n1) ; echo $ENTITY # get last trascation company name
fi fi
echo $DESCRIPTION TGTEXT=$(echo $DESCRIPTION%0A$FROMTOAT:%20$ENTITY%0A$CURRENCY:%20$AMOUNT | sed "s/ /%20/g") ; echo $TGTEXT # format text for telegram
echo $FROMTOAT: $ENTITY curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT #send to telegram
echo $CURRENCY: $AMOUNT
TGTEXT=$(echo $DESCRIPTION%0A$FROMTOAT:%20$ENTITY%0A$CURRENCY:%20$AMOUNT | sed "s/ /%20/g") # format text for telegram
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT > /dev/null #send to telegram
echo "Next check in $DELAY seconds" echo "Next check in $DELAY seconds"
else else
echo "nothing new..checking again in $DELAY seconds" echo "nothing new..checking again in $DELAY seconds"
fi fi