From 0ad15b913cf0bcb4e2c8513ec649853ffea2e75e Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Tue, 30 May 2023 22:33:13 +0500 Subject: [PATCH] added proper README.md --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 99429be..db491b3 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,63 @@ -## BML API Proxy +# BML Proxy Docker -BML API Proxy to bypass cloudflare anti-bot. -# Run with docker -First run it will compile and run. -```bash -docker compose up -d +On April 1, 2022 BML enabled [Cloudflares Anti-bot](https://www.cloudflare.com/products/bot-management/) features and all the + existing scripts to interact with BML API stopped working. + This repo contains build files for a [proxy](https://git.shihaam.dev/shihaam/bml-proxy) to bypass anti-bot. + +## Codebase repo: +- [https://git.shihaam.dev/shihaam/bml-proxy](https://git.shihaam.dev/shihaam/bml-proxy) + +## Installation + +1. [Install docker](https://docs.docker.com/engine/install/) `curl -fsSL https://get.docker.com | sudo sh` +2. Give yourself docker group and relogin. +`sudo usermod -aG docker $USER;sudo su - $USER` +3. Generate ssh key (if you havent already) +`ssh-keygen` +4. [Add your .pub key to my gitea server](https://git.shihaam.dev/user/settings/keys) +`cat ~/.ssh/id_*.pub` +5. Clone the repo `git clone git@git.shihaam.dev:shihaam/bml-proxy.git` +6. Go to cloned dir `cd bml-proxy` +7. Start the docker container `docker compose up -d` + +## How to use +This docker image exposes a proxied BML API on localhost port 3030. Any and all requests to the BML API should instead be made to this proxy instead. + +BML API URL = https://bankofmaldives.com.mv/internetbanking/api/ \ +Docker Image URL = http://localhost:3030/api/ + +### Best practices on usage: +It is recommded that you use nginx reverse proxy and cloudflare proxy with this for security and compatability reasons +1. Install Nginx, Certbot, and Nginx Cerbot plugin `sudo apt install nginx python3-certbot python3-certbot-nginx` \ +example nginx config: place this is in a file at "/etc/nginx/sites-enabled" +```nginx +server { + server_name SUB.DOMAIN.COM; + listen 80; + location / { + proxy_pass http://localhost:3030; + } +} +``` +2. Point your sub.doman.com to server IP (its important you disable cloudflare proxy) +3. Use certbot to get SSL `sudo certbot --nginx -d sub.domain.com` +4. Enable Cloudflare to fix encoding issue. +5. Use your programs to request to request to this proxy URL instead of BML URL + +#### Example +You would normally hit the following URL to retrieve today's transactions: +``` +https://www.bankofmaldives.com.mv/internetbanking/api/account/{BML_ACCOUNT_NUMBER}/history/today +``` +With this Docker image you will use the following: +``` +https://sub.domain.com/account/{BML_ACCOUNT_NUMBER}/history/today ``` -# Test locally -```bash -curl localhost:3030 -``` +## Disclaimer +This package is no way associated with [Bank of Maldives](https://www.bankofmaldives.com.mv/). + +I am not responsible for any losses incurred from the use of this package. + +Use at your own risk. +