added support for cookie server

This commit is contained in:
Shihaam Abdul Rahman 2025-01-10 07:52:09 +05:00
parent 618fc9371d
commit 0e60f139ef
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636
3 changed files with 27 additions and 0 deletions

View File

@ -4,6 +4,10 @@ source .env 2> /dev/null
accountNo=$1
COOKIE=$(curl -s $COOKIE_SERVER/getcookie)
IBSID=$(echo $COOKIE | jq -r .IBSID)
QL_0=$(echo $COOKIE | jq -r .ql_0)
curl -s 'https://faisanet.mib.com.mv/ajaxBeneficiary/getAccountName' \
-H "cookie: ql_0=${QL_0}; IBSID=${IBSID}" \
--data-raw "accountNo=${accountNo}"

View File

@ -1,15 +1,34 @@
#!/bin/bash
request_new_cookie(){
curl -s $COOKIE_SERVER/newcookie > /dev/null
}
while true; do
source .env 2> /dev/null
# Get current date and time
CURRENT_TIME=$(date -u '+%Y-%m-%dT%H:%M:%S.%3NZ')
COOKIE=$(curl -s $COOKIE_SERVER/getcookie)
IBSID=$(echo $COOKIE | jq -r .IBSID)
QL_0=$(echo $COOKIE | jq -r .ql_0)
# Make the keep-alive request
KEEP_ALIVE=$(curl -s 'https://faisanet.mib.com.mv/aProfile/keepAlive' \
-X 'POST' \
-H "cookie: ql_0=${QL_0}; IBSID=${IBSID}")
# Check for session expiration
SUCCESS=$(echo "$KEEP_ALIVE" | jq -r .success)
RESPONSE_CODE=$(echo "$KEEP_ALIVE" | jq -r .responseCode)
if [[ "$SUCCESS" == "false" && "$RESPONSE_CODE" == "3" ]]; then
echo "Session expired. Requesting new cookie..."
request_new_cookie
continue # Restart the loop
fi
# Remove the last closing brace from KEEP_ALIVE
KEEP_ALIVE_MODIFIED=${KEEP_ALIVE%?}

4
tx.sh
View File

@ -2,6 +2,10 @@
source .env 2> /dev/null
COOKIE=$(curl -s $COOKIE_SERVER/getcookie)
IBSID=$(echo $COOKIE | jq -r .IBSID)
QL_0=$(echo $COOKIE | jq -r .ql_0)
curl 'https://faisanet.mib.com.mv/ajaxAccounts/trxHistory' \
-H "cookie: ql_0=${QL_0}; IBSID=${IBSID}" \
--data-raw "accountNo=${ACCOUNT_NUMBER}&trxNo=&trxType=0&sortTrx=date&sortDir=desc&fromDate=&toDate=&start=1&end=20&includeCount=1" -s \