Compare commits
7 Commits
618fc9371d
...
main
Author | SHA1 | Date | |
---|---|---|---|
a97d52bc59
|
|||
80eb74c65c
|
|||
470df69c56
|
|||
c2ab2ea996
|
|||
37dfe7e261
|
|||
a72f22b9a4
|
|||
0e60f139ef
|
@@ -9,3 +9,8 @@ services:
|
||||
context: ../../
|
||||
dockerfile: .build/prod/api.Dockerfile
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/api
|
||||
cookieserver:
|
||||
build:
|
||||
context: ../../
|
||||
dockerfile: .build/prod/cookieserver.Dockerfile
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/cookieserver
|
||||
|
10
.build/prod/cookieserver.Dockerfile
Normal file
10
.build/prod/cookieserver.Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM python:3.9.20-slim-bookworm
|
||||
|
||||
RUN pip install beautifulsoup4 pyotp Flask python-dotenv requests
|
||||
RUN apt-get update && apt-get install -y curl jq && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY getcookie.py .
|
||||
|
||||
CMD python getcookie.py
|
@@ -1,6 +1,6 @@
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y curl jq && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
COPY keepalive.sh .
|
||||
|
@@ -6,6 +6,8 @@ PROFILE_ID=
|
||||
PROFILE_TYPE=
|
||||
ACCOUNT_NUMBER=
|
||||
|
||||
COOKIE_SERVER=http://cookieserver:5000
|
||||
|
||||
APP_DEBUG=true
|
||||
|
||||
## This valu is for time difference between request json and actual time of the transacation (+ or -) in mins, 5 or 10 is probably a good value
|
||||
|
37
.gitea/workflows/docker-build.yml
Normal file
37
.gitea/workflows/docker-build.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Build and Push Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
name: Build and Push Docker Images
|
||||
runs-on: builder
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build Docker images
|
||||
working-directory: .build/prod
|
||||
run: docker compose build
|
||||
|
||||
- name: Login to Docker Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ vars.DOCKER_REGISTRY_URL }}
|
||||
username: ${{ vars.DOCKER_REGISTRY_USER }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Push Docker images
|
||||
if: github.event_name != 'pull_request'
|
||||
working-directory: .build/prod
|
||||
run: docker compose push
|
13
README.md
13
README.md
@@ -8,15 +8,20 @@
|
||||
|
||||
## How to deploy/get started (with docker/podman)
|
||||
|
||||
1. Login to MIB web [https://faisanet.mib.com.mv/](https://faisanet.mib.com.mv/) and get the cookie:
|
||||

|
||||
2. copy .env.example to .env and fill `QL_0` and `IBSID` with contents from step 1, Make sure to fill `ACCOUNT_NUMBER` with your account number.
|
||||
1. Login to MIB web [https://faisanet.mib.com.mv/](https://faisanet.mib.com.mv/) and get the your profile id and type:
|
||||

|
||||
2. copy .env.example to .env and fill your MIB Username, Password and TOTP Seed, `PROFILE_ID` and `PROFILE_TYPE` needs to be filled with contents from step 1, Make sure to fill `ACCOUNT_NUMBER` with your account number.
|
||||
3. Create `compose.yml` with the follwing contents:
|
||||
```yaml
|
||||
services:
|
||||
keepalive:
|
||||
env_file: .env
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/keepalive
|
||||
|
||||
cookieserver:
|
||||
env_file: .env
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/cookieserver
|
||||
|
||||
api:
|
||||
env_file: .env
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/api
|
||||
@@ -24,7 +29,7 @@ services:
|
||||
- 5000:5000
|
||||
|
||||
```
|
||||
3. Run `docker compose up -d` and that is all.
|
||||
4. Run `docker compose up -d` and that is all.
|
||||
|
||||
|
||||
## Using the API with curl examples:
|
||||
|
@@ -2,6 +2,9 @@ services:
|
||||
keepalive:
|
||||
env_file: .env
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/keepalive
|
||||
cookieserver:
|
||||
env_file: .env
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/cookieserver
|
||||
api:
|
||||
env_file: .env
|
||||
image: git.shihaam.dev/shihaam/mib-payment-verify/api
|
||||
|
@@ -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}"
|
||||
|
@@ -11,7 +11,7 @@ class MIBLogin:
|
||||
def __init__(self):
|
||||
self.base_url = "https://faisanet.mib.com.mv"
|
||||
self.headers = {
|
||||
"User-Agent": "Mozilla/5.0 (give-api) ismath-owes-me-real-api/give-real-api AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36",
|
||||
"User-Agent": "Mozilla/5.0 (ismath-said-will) give-real-api/so-i-wont-have-to-do-this AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36",
|
||||
"Accept": "*/*"
|
||||
}
|
||||
self.last_cookie = None
|
||||
|
19
keepalive.sh
19
keepalive.sh
@@ -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%?}
|
||||
|
||||
|
BIN
select_profile.jpg
Normal file
BIN
select_profile.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
4
tx.sh
4
tx.sh
@@ -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 \
|
||||
|
Reference in New Issue
Block a user