forked from shihaam/bml-proxy
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
406c9ba3c3
|
|||
f7d9583c5b
|
|||
b07ec89213
|
|||
7fddc087a2
|
|||
39e4d3b96d
|
|||
66ce95adaa
|
|||
0ad15b913c
|
|||
1fb4ebe218
|
|||
1079dd6850
|
|||
9a9b4b3e68
|
|||
981e4d4f21
|
|||
1d9510e9df
|
|||
dd6d2e13e5
|
|||
1d2324ad0a
|
|||
37f834b196
|
|||
50ef4c58d9
|
|||
108171f8be
|
|||
48b11221fe | |||
c53f37406f |
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
docker-compose.yml
|
||||
Dockerfile
|
||||
README.md
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1 +1,3 @@
|
||||
/target
|
||||
target/
|
||||
.ash_history
|
||||
.bash_history
|
||||
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
FROM rust:slim-bullseye AS build
|
||||
|
||||
WORKDIR /root
|
||||
COPY . .
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y pkg-config \
|
||||
build-essential \
|
||||
openssl \
|
||||
libssl-dev
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
FROM lwthiker/curl-impersonate:0.5-chrome-slim-bullseye
|
||||
|
||||
WORKDIR /root
|
||||
COPY --from=build /root/target/release/bml_proxy /root/
|
||||
|
||||
ENV CURL_IMPERSONATE=chrome110
|
||||
ENV LD_PRELOAD="/usr/local/lib/libcurl-impersonate-chrome.so"
|
||||
|
||||
CMD /root/bml_proxy
|
63
README.md
Normal file
63
README.md
Normal file
@ -0,0 +1,63 @@
|
||||
# BML Proxy Docker
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
||||
version: '3.5'
|
||||
services:
|
||||
#########################
|
||||
bmlapi-proxy:
|
||||
build: .
|
||||
image: git.shihaam.dev/shihaam/bmlapi-proxy:latest
|
||||
hostname: bmlapi-proxy
|
||||
ports:
|
||||
- 3030:3030
|
||||
restart: always
|
@ -11,7 +11,7 @@ use warp::{http::Method, http::Response, hyper::body::Bytes, path::FullPath, Fil
|
||||
|
||||
const FOR_COPY: [&'static str; 2] = ["Content-Type", "Cookie"];
|
||||
|
||||
const BASE: &str = "https://www.bankofmaldives.com.mv/internetbanking/api/";
|
||||
const BASE: &str = "https://www.bankofmaldives.com.mv";
|
||||
const ERR: &str = "{ \"code\": 407, \"message\": \"Proxy failed\" }";
|
||||
|
||||
fn get_base_url() -> String {
|
||||
|
Reference in New Issue
Block a user